CCMenu misplaced under iOS 7

后端 未结 1 698
挽巷
挽巷 2021-01-21 08:07

Under iOS 6 all my CCMenus appeared centered on the screen by default, if I did not assign an explicit position. Under iOS 7 the menus are positioned off screen

相关标签:
1条回答
  • 2021-01-21 08:29

    Basically there are two underlying problems.

    1. If you have hidden your status bar under iOS 6, this will not work for iOS 7 without adding an additional value to your Info.plist (View controller-based status bar appearance -> NO)

    2. Due to a bug in Cocos2D your screen size will be calculated wrong, if your status bar is visible.

    You have to different options to solve this problem:

    1. Set a CCMenu position explicitly instead of using the implicit positioning (e.g: menu.position = ccp(self.contentSize.width/2, self.contentSize.height/2);)
    2. Set View controller-based status bar appearance -> NO in your Info.plist if you don't want to show the status bar anyway
    0 讨论(0)
提交回复
热议问题