在肖像模式下,我在UISplitViewController上展示了一个模式视图控制器。现在,我将iPad旋转到横向模式,并关闭模式视图控制器。
似乎UISplitViewController没有收到更改方向的通知:拆分视图控制器的第一个视图被隐藏,第二个视图没有占据整个屏幕尺寸。
如果我再次来回旋转,拆分视图控制器将再次正常显示。
此外,该问题仅出现在iOS模拟器5.0 (或运行iOS5的设备)上,而不出现在4.3上。
有什么想法吗?
发布于 2012-05-17 01:29:46
我也有同样的问题。
在我的项目中,splitViewController被添加为window上的子视图。并且它正常地接收轮换消息。但是当我试图添加我的“模式”viewController作为窗口上的子视图时,它没有收到旋转消息。看起来循环消息只接收索引为0的子视图。所以我这样解决了这个问题:
显示“模式”viewController
[appDelegate.window insertSubview:myModalViewController.view atIndex:0];
[appDelegate.splitViewController.view removeFromSuperview];隐藏“模式”viewController
[appDelegate.window insertSubview:appDelegate.splitViewController.view atIndex:0];
[myModalViewController.view removeFromSuperview];但是这个解决方案有一个缺点:在调用"[appDelegate.window insertSubview:myModalViewController.view atIndex:0]“方法之后,modalViewController不会立即加载它的视图。为了修复这个缺陷,我只是暂时将其呈现为模式:
显示“模式”viewController:
// present and dismiss methods are called to cause viewDidLoad in modalViewController
[appDelegate.splitViewController presentModalViewController:myModalViewController animated:NO];
[appDelegate.splitViewController dismissModalViewControllerAnimated:NO];
[appDelegate.window insertSubview:myModalViewController.view atIndex:0];
[appDelegate.splitViewController.view removeFromSuperview];发布于 2011-10-21 16:11:11
我在这里遇到了同样的问题:Not working Orientation Notifications in VIewController under modal, with iOS5。
要在mainController中调用您想要的方法,您必须在模式中使用这些神奇的行,只要在控制旋转的方法中就可以:
yourProjectAppDelegate *delegate = (yourProjectAppDelegate*) [[UIApplication sharedApplication]delegate];
yourProjectViewController *i=((yourProjectViewController *)delegate.window.yourConfigurationOfController);
[i didRotateFromInterfaceOrientation:interfaceOrientationReceived];在i id中,您使用的对象是: yourConfigurationOfController,我想在本例中是UISPlit。如果i,不是你的uiSplit,你可以通过变量的级联到达。interfaceOrientationReceived是在模式中接收到的方向:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation希望能帮上忙!祝好运!
(为我的英语道歉:)
https://stackoverflow.com/questions/7767302
复制相似问题