[英]trouble in setting rotation orientation in animation
我有2个UIView,我想以不同的方向旋转它们。 这是我的代码
- (void)viewDidLoad
{
[super viewDidLoad];
// middleView and bigView are outlets of UIView
self.middleView.transform=CGAffineTransformMakeRotation(M_PI);
self.bigView.transform=CGAffineTransformMakeRotation(-M_PI);
}
- (IBAction)smallTouched:(id)sender {
[UIView animateWithDuration:0.5 animations:^{
self.middleView.transform=CGAffineTransformMakeRotation(0);
self.bigView.transform=CGAffineTransformMakeRotation(0);
}];
}
并且两个视图都以逆时针方向旋转。 我不知道为什么
因为sin(PI)== sin(-PI)和cos(PI)== cos(-PI),所以CGAffineTransformMakeRotation(M_PI)
等于CGAffineTransformMakeRotation(-M_PI)
。 您可以尝试M_PI * 179.9 / 180
和-M_PI * 179.9 / 180
或类似的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.