我有一个由一堆UILabel组成的视图。截至目前,视图仅配置为在设备的方向为纵向时工作,但是我想这样做以便在旋转设备时更改一个特定的UILabel位置并放大文本大小。当设备的方向恢复为肖像时,我希望它恢复到原始状态。
我该怎么做呢?
答案 0 :(得分:2)
在ViewController中实现此方法并相应地进行更改。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
// do something in landscape orientation
} else {
// do something in portrait orientation
}
}