Xcode5.0.2设置横屏

找到RootViewController.mm将相应的函数改成如下代码:

*/
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}

// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
    
    return UIInterfaceOrientationMaskLandscape;
#endif
}

- (BOOL) shouldAutorotate {
    return YES;
}

设置target的属性如下。之前不管怎么选择游戏界面都会自动旋转过来,后来一个都不选居然OK了...

原文地址:https://www.cnblogs.com/tranquil/p/3592775.html