CCMenu错位在iOS 7下 [英] CCMenu misplaced under iOS 7
问题描述
在iOS 6下,我的所有CCMenus出现在屏幕上默认中心,如果我没有分配一个明确的位置。 在iOS 7下,菜单位于屏幕外。
我必须在iOS 7下指定显式位置吗?
iOS 6:
>
iOS 7:
基本上有
如果您在iOS 6下隐藏了状态栏,那么这将不适用于iOS 7向您的 Info.plist (查看基于控制器的状态栏外观 - >否)由于Cocos2D中的错误, ,如果您的状态栏是可见的。
您必须使用不同的选项解决此问题:
- 显式设置CCMenu位置,而不是使用隐式
定位(例如:menu.position = ccp(self.contentSize。 width / 2,self.contentSize.height / 2);
) - 设置查看基于控制器的状态栏外观 - > NO 。 t仍要显示状态栏
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:
Basically there are two underlying problems.
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)
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:
- Set a CCMenu position explicitly instead of using the implicit
positioning (e.g:
menu.position = ccp(self.contentSize.width/2, self.contentSize.height/2);
) - Set View controller-based status bar appearance -> NO in your Info.plist if you don't want to show the status bar anyway
这篇关于CCMenu错位在iOS 7下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!