AVPlayer 音视频学习iOS技术专题iOS开发

iOS纯代码实现 强制横屏

2016-04-24  本文已影响2947人  解忧杂货店老板

iOS9.0强制横屏

适用于“当需要在某个竖屏的情况下点击一个按钮跳转到另一个横屏的controller”

- (BOOL) shouldAutorotate {    
    return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations { 
    return [self.viewControllers.lastObject supportedInterfaceOrientations];
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
    return [self.viewControllers.lastObject referredInterfaceOrientationForPresentation];
}
- (BOOL)shouldAutorotate {
    return YES;
}
- (UIInterfaceOrientationMask) supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
**//此处填写你需要让第二级controller现实的横屏方向**
    return UIInterfaceOrientationLandscapeLeft;
}

要看的更真切的话,用代码说话.
请转到我的github:https://github.com/FocusLyn/LandscapeLeft

That's all. Thx reading.
上一篇下一篇

猜你喜欢

热点阅读