Nov*_*Joe 21 rotation orientation uinavigationcontroller ios
好的,所以情况如下:
我有一个应用程序,我只希望UINavigationController中的一个特定视图具有横向方向.这个视图是一个UIImageView,我正在捕获一个签名(这部分工作真棒).所以,像这样:
previous view --> signature view --> next view
(portrait) (landscape) (portrait)
Run Code Online (Sandbox Code Playgroud)
我似乎无法找到一种强制方法来强制设备方向在该签名屏幕上显示横向.在签名视图上具有纵向方向永远不会有意义,因为在该屏幕宽度上签名的空间确实不足.
那么,关于如何实现这一点的任何好主意?我考虑过可能以模态方式进行签名视图,从而打破导航控制器.思考?
您可以尝试强制设备旋转到必要的方向 - 但您需要手动处理它(除了重写UIViewController方向处理方法).
要旋转设备,您可以使用下一个方法:
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
Run Code Online (Sandbox Code Playgroud)
但它可能不适用于所有情况......
也可用无证方法:
[[UIDevice currentDevice] performSelector:NSSelectorFromString(@"setOrientation:")
withObject:(__bridge id)((void*)UIInterfaceOrientationLandscapeLeft)];
Run Code Online (Sandbox Code Playgroud)
只是覆盖这个UIViewController方法,只返回如此横向的true,并且iphone将被强制旋转到该设备方向,因为它没有其他选项.
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12049 次 |
最近记录: |