Che*_*kie 11 orientation uiviewcontroller ios6
在iOS 5中,我的应用程序使用该方法来改变我的方向:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
在iOS 6中我认为我应该这样做,但它什么都不做!我的应用程序旋转不是我想要的方式.
- (BOOL) shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
Run Code Online (Sandbox Code Playgroud)
Che*_*kie 28
这就是我添加我的方式viewController.
我替换了这行代码:
[window addSubview:viewController.view];
Run Code Online (Sandbox Code Playgroud)
通过这一行:
[window setRootViewController:viewController];
Run Code Online (Sandbox Code Playgroud)
Dan*_*iel 15
当设备更改方向时,在iOS 6中,系统会询问应用程序支持的方向.应用程序将返回它接受的多个方向.
应用程序如何确定其方向?
-(NSUInteger)application:supportedInterfaceOrientationsForWindow:方法指定.这有效地覆盖了info.plist设置,这个实现是可选的.默认情况下,iPad应用程序可以向各个方向定位,而iPhone则可以完全颠倒.UINavigationController或UIViewController...等,然后它指定如何呈现以及是否要自动旋转.这些UIViewControllers可以使用shouldAutorotate:和supportedInterfaceOrientations方法告诉应用程序委托如何呈现它.您必须确保设置窗口的根视图控制器.
此外,如果您以全屏显示任何其他视图控制器,例如模态视图控制器,则负责确定方向更改的人员.
| 归档时间: |
|
| 查看次数: |
13935 次 |
| 最近记录: |