我想使用动画将我的UIButton
旋转M_PI/4
。以下是我的代码:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[UIView animateWithDuration:.5 animations:^{
self.closeButton.transform = CGAffineTransformMakeRotation(M_PI/4);
}];
}
但这会使我的按钮框架损坏。动画前的框架为
(260 0; 44 44)
,动画后变为(250.887 -9.1127; 62.2254 62.2254)
。
我看到了this和其他一些帖子,但我不明白如何通过M_PI/2
实现UIButton的旋转动画。