Cocos2d 3.0设置纵向

时间:2014-02-18 06:01:38

标签: cocos2d-iphone

已经在AppDelegate.m中添加了以下代码,但仍然无法正常工作。

-(NSUInteger)supportedInterfaceOrientations {
  return UIInterfaceOrientationMaskPortrait;

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

这是Xcode摘要页面: enter image description here

1 个答案:

答案 0 :(得分:7)

得到解决方案。我们可以在setupCocos2dWithOptions中设置方向。

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

    return YES;
}