UIView动画
2016-01-25 19:21
316 查看
1.block式动画
横向或纵向移动XY
[UIView animateWithDuration:0.5 animations:^{
self.aView.frame = CGRectMake(_aView.frame.origin.x, _aView.frame.origin.y + 50, _aView.frame.size.width, _aView.frame.size.height);
}];
或者
[UIView animateWithDuration:0.5 animations:^{
//_aView.transform = CGAffineTransformMakeTranslation(0, 20);
_aView.transform = CGAffineTransformTranslate(_aView.transform, 10, 10);
}];
渐变效果
[UIView animateWithDuration:0.5 animations:^{
_aView.alpha = !_aView.alpha;
}];
2.头尾式动画 ---翻页效果
[UIView beginAnimations:nil context:nil] 开始配置动画
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_aview cache:NO];
[UIView commitAnimations] 配置完毕,提交动画
旋转效果
旋转一次
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformMakeRotation(M_PI);
}];
旋转多次
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformRotate(_aView.transform, M_PI_4);
}];
放大效果
[UIView animateWithDuration:0.2 animations:^{
//_aView.transform = CGAffineTransformMakeScale(2, 2);
_aView.transform = CGAffineTransformScale(_aView.transform, 1.1, 1.1);
}];
缩小
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformMakeScale(0.5, 0.5);
}];
还原
_PinkView.transform = CGAffineTransformIdentity;
横向或纵向移动XY
[UIView animateWithDuration:0.5 animations:^{
self.aView.frame = CGRectMake(_aView.frame.origin.x, _aView.frame.origin.y + 50, _aView.frame.size.width, _aView.frame.size.height);
}];
或者
[UIView animateWithDuration:0.5 animations:^{
//_aView.transform = CGAffineTransformMakeTranslation(0, 20);
_aView.transform = CGAffineTransformTranslate(_aView.transform, 10, 10);
}];
渐变效果
[UIView animateWithDuration:0.5 animations:^{
_aView.alpha = !_aView.alpha;
}];
2.头尾式动画 ---翻页效果
[UIView beginAnimations:nil context:nil] 开始配置动画
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_aview cache:NO];
[UIView commitAnimations] 配置完毕,提交动画
旋转效果
旋转一次
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformMakeRotation(M_PI);
}];
旋转多次
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformRotate(_aView.transform, M_PI_4);
}];
放大效果
[UIView animateWithDuration:0.2 animations:^{
//_aView.transform = CGAffineTransformMakeScale(2, 2);
_aView.transform = CGAffineTransformScale(_aView.transform, 1.1, 1.1);
}];
缩小
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformMakeScale(0.5, 0.5);
}];
还原
_PinkView.transform = CGAffineTransformIdentity;
相关文章推荐
- iOS-UITextField限制输入的字符个数
- view
- Builder模式
- Performance Comparison - Identity() x NewId() x NewSequentialId
- location.false(true)
- 连续子数组的最大和/1007. Maximum Subsequence Sum (25)
- UI线程阻塞监控工具----BlockCanary
- uva 10810 - Ultra-QuickSort
- UI性能分析工具Systrace
- 聊聊并发(6)ConcurrentLinkedQueue的实现原理分析
- UIScrollViewDelegate
- self.tableView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.3];
- 嵌套JSON 取出name与value
- 锐捷(ruijie)交换机enable密码重置
- WaterfallFlowLayout瀑布流用重写UICollectionViewFlowLayout类实现
- js之require.js三
- WaterfallFlowLayout瀑布流用重写UICollectionViewFlowLayout类实现
- kernel编译生成Image zImage uImage的区别
- HPU15级练习(一)并查集 :A - Ubiquitous Religions
- Hbuilder常用快捷键功能.html