UIView的简单动画
2016-11-04 18:36
260 查看
UIView的简单动画
//方法1//设置简单动画 //1.开始动画 [UIView beginAnimations:nil context:nil]; //2.持续时间 [UIView setAnimationDuration:2.0]; //3.动画效果 fatherView.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2); //4.提交动画 [UIView commitAnimations];
//方法2
[UIView animateWithDuration:1.0 animations:^{ //动画效果 fatherView.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2); } completion:^(BOOL finished) { //动画结束时调用 fatherView.frame = CGRectMake(0, 0, 200, 200); }];
UIView简单动画test
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. _view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; _view.backgroundColor = [UIColor redColor]; [self.view addSubview:_view]; [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(timeGo) userInfo:nil repeats:YES]; } - (void)timeGo { [UIView animateWithDuration:2.0 animations:^{ _view.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2); } completion:^(BOOL finished) { _view.frame = CGRectMake(0, 0, 100, 100); }]; }
相关文章推荐
- Iphone开发之UIView中的简单动画:滑动显示,淡入淡出
- ios菜鸟之路:UIView简单的动画
- self.view 添加子视图 和 简单的 UIView 的组合动画
- iphone 非常简单的UIView淡入淡出动画
- swift UIView简单动画
- UIView的简单动画
- UIView简单动画
- ios--UIView动画简单示例
- IOS中UIView动画的简单实现
- swift UIView简单动画
- 2.7 UIView动画简单示例
- UIview简单动画
- ios--UIView简单动画
- UIView控件的一些常用方法和简单动画设置
- iOS UIView简单的缩放动画效果
- iOS之UIView简单动画
- UIView简单动画
- 关于UIView的简单动画效果
- iOS UIView简单缩放动画
- UIView动画 今天项目里面用到,简单好用。