Cocos2d iphone Cocos2d 3.0设置纵向方向

Cocos2d iphone Cocos2d 3.0设置纵向方向,cocos2d-iphone,Cocos2d Iphone,已经在AppDelegate.m中添加了下面的代码,但在纵向中仍然不起作用 -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceO

已经在AppDelegate.m中添加了下面的代码,但在纵向中仍然不起作用

-(NSUInteger)supportedInterfaceOrientations {
  return UIInterfaceOrientationMaskPortrait;

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
以下是Xcode摘要页面:
找到了解决方案。我们可以使用选项在SetupCoCos2d中设置方向

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self setupCocos2dWithOptions:@{
        CCSetupShowDebugStats: @(YES),
        CCSetupScreenOrientation: CCScreenOrientationPortrait,
    }];

    return YES;
}