Guru
Guru

Reputation: 22042

Cocos2d 3.0 Set Portrait orientation

Already added below code in AppDelegate.m but still not working in portrait.

-(NSUInteger)supportedInterfaceOrientations {
  return UIInterfaceOrientationMaskPortrait;

}

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

Here is Xcode summary page: enter image description here

Upvotes: 2

Views: 2047

Answers (1)

Guru
Guru

Reputation: 22042

Got solution. We can set orientation in setupCocos2dWithOptions.

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

    return YES;
}

Upvotes: 7

Related Questions