Saturday, November 24, 2012

Multi-level Template display issue in iOS 6 fixed

Thanks to Nick Wilson who pointed out that my Cocos2d Multi-page template doesn't display properly in iOS 6.

As shown below, when loaded in iOS6 it always displays in Portrait mode, and gets quite messy.



Did some research and got it working by making 2 small changes:


1) in "AppDelegate.m", inside "applicationDidFinishLaunching", insert the line highlighted in red as shown below, before "[window makeKeyAndVisible]"

// make the View Controller a child of the main window
[window addSubviewviewController.view];
window.rootViewController = viewController;
    
[window makeKeyAndVisible];

2) then in "RootViewController.m" add a new method anywhere as below:

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}


That's it. Let me know if this works for you or if you have any other problems.

Cheers.

[Update 25/11/2012]
Nick also pointed out, the other extra thing to change would be to add an iPhone 5 background image.

I have included all these and uploaded V1.02 as below, links in original post also updated. Special thanks to Nick for all the info, let me know if any one else got other excellent ideas to add.

Code: Multi-level template V1.02
Image: Image Files V1.02


// Ver 1.00 - 28/09/2012 First version
// Ver 1.01 - 24/11/2012 Fixed iOS 6 orientation issue
// Ver 1.02 - 25/11/2012 Add background image for iPhone 5 (1136x640), add version number display on Main Menu


0 comments:

Post a Comment