因此,在我的应用程序中,我有一个导航堆栈,用户可以在其中浏览各种 View Controller 。某些 View 支持多个方向,而其中一个 View 则不支持。所以我的问题是,如何强制一个特定的 UIViewController 仅以一种方向显示。我需要这个在第一次加载 View 时以及当另一个 View 弹出并且该 View 再次可见时工作。谢谢
我实现了这两种方法来控制 View 的旋转:
-(void)orientationDidChange:(NSNotification *)notification
-(BOOL)shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
谢谢
最佳答案
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
关于iphone - 强制 UIViewController 加载特定方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8830039/