我有一个情况,其中我有多个视图通过 UITabBarController 控制。其中一个视图通过 UINavigationController 控制。应用程序应该只支持纵向的所有视图...除了一个单独的视图。这个视图被推到导航控制器的堆栈,应该允许纵向和横向。
I have a situation where I have multiple views controlled via UITabBarController. One of those views is controlled via a UINavigationController. The application should only support Portrait for all views... except one single solitary view. This view is pushed onto the stack of the navigation controller and should allow both portrait AND landscape.
我尝试了每个解决方案,我想到的,但是,解决方案只是不工作或更糟的是完全不可预测。
I've tried every solution that I can think of but, either the solution just doesn't work or worse is completely unpredictable.
有人以干净的方式解决了这个问题吗?
Has anybody solved this issue in a clean way?
推荐答案您使用 presentModalViewController 或 pushViewController 呈现的视图控制器应该支持任何方向,使用此方法:
The view's controller that you present either using presentModalViewController OR pushViewController should support any orientation, using this method:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; }使用这种方法,当您以横向显示控制器时,也以横向方向显示。
With this method, when you present your controller in landscape orientation, it will correctly appear in landscape orientation, too.
更多推荐
允许一个视图支持多个方向,而其他人不要
发布评论