1,在info.plist 文件中添加
2,ViewController.m中-----------最上层的Controller
@implementation UINavigationController (autorotation)
- (BOOL)shouldAutorotate {
return NO;//禁止旋转
}
- (NSUInteger)supportedInterfaceOrientations {
//需要强制竖屏
return UIInterfaceOrientationMaskPortrait;
}
@end
3,从ViewController.m 如何跳转到 需要横屏的页面
[self presentViewController:[[VEShareViewController alloc] init] animated:YES completion:nil];
4,需要横屏的页面
- (BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
//需要强制横屏
return UIInterfaceOrientationMaskLandscape;
}
5,返回到 ViewController.m中
[self dismissViewControllerAnimated:YES completion:nil];