ces*_*ola 6 iphone rotation uiwindow
我的应用程序使用2个UIWindows.第一个显示的TabBar控制器带有ViewControllers,只能旋转到纵向方向.到这里一切都很好.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (UIInterfaceOrientationIsPortrait(interfaceOrientation));
}
Run Code Online (Sandbox Code Playgroud)
在另一个窗口,我有一个旋转到所有方向的UIViewController.
问题是当我显示第二个窗口时
[secondWindow makeKeyAndVisible];
Run Code Online (Sandbox Code Playgroud)
然后回到第一个
[firstWindow makeKeyAndVisible];
Run Code Online (Sandbox Code Playgroud)
状态栏将旋转到所有方向,并且不会触发事件shouldAutorotateToInterfaceOrientation.我该如何解决这个问题?
在一个应用程序中具有多个UIWindows很好,但是这里需要说明的是,Apple的代码似乎会检查您拥有的每个UIWindow,并查看最顶部的视图控制器是否允许特定旋转。如果这些窗口中的任何一个允许旋转,则无论UIWindow位于最前面还是可见,状态栏都会旋转。
在我自己的应用程序中,我隐藏了我不使用的UIWindow,并在相关的UIViewControllers中添加了isHidden检查,以在当前隐藏窗口时不允许旋转。
| 归档时间: |
|
| 查看次数: |
1337 次 |
| 最近记录: |