大佬教程收集整理的这篇文章主要介绍了ios – Autolayout违反了翻译轮换动画,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的旋转动画代码:
#define ROTATE_DURATION 3.0 - (IBACtion)rotateArrow { CGAffineTransform transform = self.hand.transform; NSLog(@"layer possition before animation x: %f; y: %f",self.hand.layer.position.x,self.hand.layer.position.y); [UIView animateWithDuration:rOTATE_DURATION/3 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{ self.hand.transform = CGAffineTransformRotate(transform,2*M_PI/3) ; [self.hand layoutIfNeeded]; NSLog(@"layer possition after animation 1 x: %f; y: %f",self.hand.layer.position.y); } completion:^(BOOL finished) { [UIView animateWithDuration:rOTATE_DURATION/3 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{ self.hand.transform = CGAffineTransformRotate(transform,-2*M_PI/3) ; [self.hand layoutIfNeeded]; NSLog(@"layer possition after animation 2 x: %f; y: %f",self.hand.layer.position.y); } completion:^(BOOL finished) { [UIView animateWithDuration:rOTATE_DURATION/3 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{ self.hand.transform = CGAffineTransformRotate(transform,0) ; [self.hand layoutIfNeeded]; NSLog(@"layer possition after animation 3 x: %f; y: %f",self.hand.layer.position.y); } completion:^(BOOL finished) { }]; }]; }]; }
所以有什么问题:
当旋转正在进行时,UIView会改变它的center和layer.position属性,这就是为什么我的UIView在动画时会“跳转”.如果关闭自动布局,动画就可以了.我观看了WWDC 2012“按示例自动布局”,发现我会使用[self.hand layoutIfNeeded];一切都很好,但根本不是.动画变得更加平滑,但我看到这种“跳跃”.所以,这是我的“输出”.
当它是动画时,UIView向右移动,就像你在图像上看到的那样,而不是回到正常位置.我怎样才能解决这个“跳跃”问题?
这是@L_616_4@日志:
layer possition before animation x: 160.000000; y: 99.500000 layer possition after animation 1 x: 197.349030; y: 114.309601 layer possition after animation 2 x: 197.349030; y: 114.309601 layer possition after animation 3 x: 160.000000; y: 99.500000
谢谢.
以上是大佬教程为你收集整理的ios – Autolayout违反了翻译轮换动画全部内容,希望文章能够帮你解决ios – Autolayout违反了翻译轮换动画所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。