CCMenu misplaced under iOS 7

偶尔善良 提交于 2019-12-02 00:11:00

问题


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.

Do I have to assign an explicit position under iOS 7?

iOS 6:

iOS 7:


回答1:


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


来源:https://stackoverflow.com/questions/19438939/ccmenu-misplaced-under-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!