已经在AppDelegate.m中添加了以下代码,但仍然无法正常工作。
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
这是Xcode摘要页面:
答案 0 :(得分:7)
得到解决方案。我们可以在setupCocos2dWithOptions中设置方向。
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self setupCocos2dWithOptions:@{
CCSetupShowDebugStats: @(YES),
CCSetupScreenOrientation: CCScreenOrientationPortrait,
}];
return YES;
}