【发布时间】:2014-05-07 08:22:26
【问题描述】:
嘿伙计们,我见过很多类似的问题,但无法找到任何解决方案。我正在使用情节提要创建一个通用应用程序,并拥有一个具有根视图控制器 v1 的导航控制器,因此最初的顶视图控制器是 v1。单击 v1 上的按钮时,它会推送视图控制器 v2。现在我希望该应用程序应该为除视图控制器 v2 之外的所有视图控制器向所有方向旋转。我检查了部署信息中的所有设备方向,并尝试创建 uinavigationcontroller 类别
#import <UIKit/UIKit.h>
@interface UINavigationController (autorotation)
-(BOOL)shouldAutorotate;
-(NSUInteger)supportedInterfaceOrientations;
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation;
@end
#import "UINavigationController+autorotation.h"
#import "AboutViewController.h"
@implementation UINavigationController (autorotation)
-(NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
-(BOOL)shouldAutorotate
{
return [self.topViewController shouldAutorotate];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [self.topViewController preferredInterfaceOrientationForPresentation];
}
我的问题是应用程序正在为所有屏幕旋转,但我想如上所述停止视图控制器 v2 的旋转。我真的有我的两天请帮帮我
【问题讨论】:
-
这个link 将对您有所帮助,因为我对其进行了测试并且它有效。不要忘记投票并勾选我的答案!
标签: objective-c ios7 uinavigationcontroller