首先确认你的工程级别 支持横屏
然后在你的UIViewController中:
override func shouldAutorotate() -> Bool { return false } override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { return UIInterfaceOrientationMask.LandscapeLeft } override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation { return UIInterfaceOrientation.LandscapeLeft }
在启动这个UIViewController中,注意一定要present,不要push,这是个关键
[self.navigationController presentViewController:controller animated:YES completion:nil];
更多可以参考:http://stackoverflow.com/questions/17063020/how-to-load-a-uiviewcontroller-in-landscape-mode-if-its-parent-is-in-portrait-mo