[英]iOS - iPad Air and iPad Pro force device orientation in landscape only
I am try to implement iOS app particular view controller always open only landscape mode. 我试图实现iOS应用程序特定的视图控制器始终只打开横向模式。 i add following code in viewWillAppear.
我在viewWillAppear中添加以下代码。
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
above coding working fine following devices iPhone 4s/5/5s/6/6s and iPad 2/Retina. 上面的代码可以很好地在以下设备上正常运行:iPhone 4s / 5 / 5s / 6 / 6s和iPad 2 / Retina。 but iPad Air/Air 2/Pro not working.
但是iPad Air / Air 2 / Pro无法正常工作。 how to resolve this problem.
如何解决这个问题。 please guide me thanks.
请指导我谢谢。
Instead of device orientation Use following in Your ViewController: 代替设备方向在ViewController中使用以下命令:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.