我有一个由一堆 UILabel 组成的 View 。截至目前,该 View 仅配置为在设备的方向为纵向时工作,但是我想这样做,以便在旋转设备时更改一个特定的 UILabel 的位置并放大文本大小。当设备的方向恢复为纵向时,我希望它恢复到原始状态。
我应该怎么做?
最佳答案
在您的 ViewController 中实现此方法并进行相应的更改。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
// do something in landscape orientation
} else {
// do something in portrait orientation
}
}
关于ios - UIView旋转文字操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7942476/