【发布时间】:2012-03-16 08:09:27
【问题描述】:
我有一个支持所有四个方向的父视图控制器。它呈现一个子视图控制器,如果在呈现子视图控制器时设备旋转,然后您关闭子视图,则父视图控制器不会正确旋转。这是我在父视图控制器中用于旋转的代码:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
newestIssueCoverImageButton.frame = CGRectMake(40, 20, 688, 865);
shadow.frame = CGRectMake(40, 20, 688, 865);
recordView.frame = CGRectMake(0, 44, 768, 916);
classifiedsWebView.frame = CGRectMake(0, 44, 768, 916);
} else {
newestIssueCoverImageButton.frame = CGRectMake(269, 20, 486, 613);
shadow.frame = CGRectMake(269, 20, 486, 613);
recordView.frame = CGRectMake(0, 44, 1024, 660);
classifiedsWebView.frame = CGRectMake(0, 44, 1024, 660);
}
虽然没有使用此代码,但我只是旋转了设备。如何调用此代码并确保当用户当前正在查看子视图时父视图控制器正确旋转?感谢您的帮助。
【问题讨论】:
标签: iphone objective-c ios ipad uiviewcontroller