1.先在项目的ios目录下的AppController.mm文件中的
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
方法中
- <span style="font-size:14px;">// Set RootViewController to window
- [window addSubview: viewController.view];</span>
替换为
- <span style="font-size:14px;">// Set RootViewController to window
- if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
- {
- // warning: addSubView doesn't work on iOS6
- [window addSubview: viewController.view];
- }
- else
- {
- // use this mehod on ios6
- [window setRootViewController:viewController];
- }</span>
2.在ios目录的RootViewController中添加两个方法
- <span style="font-size:14px;">- (NSUInteger) supportedInterfaceOrientations{
- return UIInterfaceOrientationMaskLandscape;
- }
- - (BOOL) shouldAutorotate {
- return YES;
- }</span>