我想创建一个 UINavigationController,带有一个主视图 Controller 和一个详细 View Controller 。
主视图 Controller 可以在Portrait和LandscapeRight中旋转,而Detail View Controller只能在LandscapeRight中查看(Detail显示电影)。
设置此功能的最佳方法是什么?
最佳答案
我建议添加以下代码行
在您的主视图 Controller 上:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
以及您的详细 View Controller
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
这应该可以解决问题。
关于objective-c - 具有不同方向的 UINavigationcontroller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9281409/