在 iOS 7 下 CCMenu 错位

2024-08-12移动开发问题
1

本文介绍了在 iOS 7 下 CCMenu 错位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

在 iOS 6 下,如果我没有指定明确的位置,我所有的 CCMenus 都默认显示在屏幕中央.在 iOS 7 中,菜单位于屏幕外.

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.

在 iOS 7 下我必须明确指定位置吗?

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

推荐答案

基本上有两个潜在的问题.

  1. 如果你在 iOS 6 下隐藏了你的状态栏,这将不适用于 iOS 7,除非你在 Info.plist (查看基于控制器的状态栏外观 -> 否)

由于 Cocos2D 中的一个错误,如果您的状态栏可见,您的屏幕尺寸将被计算错误.

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. 显式设置 CCMenu 位置,而不是使用隐式定位(例如:menu.position = ccp(self.contentSize.width/2, self.contentSize.height/2);)
  2. 设置查看基于控制器的状态栏外观->如果您不想显示状态栏,请在 Info.plist 中选择 NO

这篇关于在 iOS 7 下 CCMenu 错位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

突出显示朗读文本(在 iPhone 的故事书类型应用程序中)
Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))...
2024-08-12 移动开发问题
9

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

正确的 cocos2d 场景重启?
Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)...
2024-08-12 移动开发问题
7