大佬教程收集整理的这篇文章主要介绍了ios – UIView动画不起作用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@property (nonatomic,strong) UIView *myView; @property (nonatomic,strong) UIView *setTingView; - (void)viewDidLoad { [super viewDidLoad]; UIBarButtonItem* setTingButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@SELEctor(showSetTingView)]; self.navigationItem.rightBarButtonItem = setTingButton; } - (void)showSetTingView { self.myView = [[UIView alloc]initWithFrame:CGRectMake(0,568,320,480)]; self.myView.opaque = NO; self.myView.BACkgroundColor = [UIColor colorWithWhite:1.0f alpha:0.0f]; [self.view addSubview:self.myView]; if (!self.setTingView) { self.setTingView = [[UIView alloc]initWithFrame:CGRectMake(0,568)]; self.setTingView.BACkgroundColor = [UIColor blackColor]; [self.myView addSubview:self.setTingView]; [UIView animateWithDuration:0.3f delay:0.0f options:UIViewAnimationOptionTransitionFlipFromBottom animations:^{self.myView.frame = CGRectMake(0,60,480);} completion:^(BOOL finished) {} ]; } else if (self.myView){ self.myView.frame = CGRectMake(0,480); [UIView animateWithDuration:0.3f delay:0.0f options:UIViewAnimationOptionCurveEaseIn animations:^{self.myView.frame = CGRectMake(0,480);} completion:^(BOOL finished) {} ]; [self.setTingView removeFromSuperview]; self.setTingView = nil; [self.myView removeFromSuperview]; } }
谢谢.
[UIView animateWithDuration:0.3f delay:0.0f options:UIViewAnimationOptionCurveEaseIn animations:^{self.myView.frame = CGRectMake(0,480);} completion:^(BOOL finished) { [self.setTingView removeFromSuperview]; self.setTingView = nil; [self.myView removeFromSuperview]; } ];
A.在块之前设置myView的约束而不是框架,然后在块内部仅调用layoutIfNeeded:.
B.在动画块中设置transform属性.
以上是大佬教程为你收集整理的ios – UIView动画不起作用全部内容,希望文章能够帮你解决ios – UIView动画不起作用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。