Saturday, 24 November 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


4 comments:

  1. Which version of Cocos2d is this based on?

    ReplyDelete
  2. HI, it's version 1.01

    // 0x00 HI ME LO
    // 00 01 00 01
    #define COCOS2D_VERSION 0x00010001

    ReplyDelete
  3. Hello,

    Why you use TexturePacker?

    What you sugest for fast implement of full and lite version for in lite version only can play a few game levels?

    Regards

    ReplyDelete
    Replies
    1. It's just personal preference, you are welcomed to use other tools if it can accomplish the same thing.

      Only play a few game levels would the normally used method for lite version, I suppose.

      Delete