作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想用动画将我的 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 动画旋转。
最佳答案
Xcode - 10
swift - 4x
self.yourView.transform = CGAffineTransform(rotationAngle: .pi/4)
这可以帮助您将 uiview 旋转 45 度
关于ios - 如何将 UIView 旋转 45 度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22512203/
我是一名优秀的程序员,十分优秀!