我是一个支持所有四个方向的父视图控制器。它会呈现子视图控制器,如果在子视图控制器呈现时旋转设备,然后关闭子视图控制器,父视图控制器不会正确地旋转。以下是我在父视图控制器中使用的旋转代码:
- (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);
}
父视图看起来好像这段代码并没有被调用,只是我旋转了设备。我该如何调用这段代码,并确保当用户正在查看子视图时,父视图控制器的旋转正确?谢谢您的帮助。