问题描述
我在更新 UILabel 时遇到了一个小问题.我尝试了一个Pong"游戏教程,它为球和球员使用 UIViews.所以我在故事板的帮助下将它们定位在它们的起始位置.游戏运行良好,但如果我实现一个 UILabel 来显示玩家分数,麻烦就开始了.随着 UILabel 的每次更新,UIViews 都会重新定位到它们的起点.iOS 6 有什么变化吗?
I have a small problem with updating an UILabel. I tried a "Pong" Game tutorial which uses UIViews for the ball and the players. So I positioned them with the help of the storyboard on their start positions. The game works well, but if I implement a UILabel for displaying the players scores the trouble starts. With every update of the UILabel the UIViews get repositioned to their starting points. Was there something changed in iOS 6?
推荐答案
我遇到了类似的问题.解决方案是关闭自动布局
I ran into a similar issue. The solution was to turn off Autolayout
- 选择您的故事板(可能称为MainStoryboard.storyboard)
- 点击实用工具面板中的显示文件检查器(又名
command
+option
+0
通过command
+option
+1
) - 在 Interface Builder Document 部分,取消选中 Use自动布局复选框
- 重新运行代码
- Select your storyboard (probably called MainStoryboard.storyboard)
- Click on the Show the File inspector in the Utilities panel (aka
command
+option
+0
followed bycommand
+option
+1
) - In the Interface Builder Document section uncheck the UseAutolayout checkbox
- Rerun your code
这篇关于UILabel 更新重置视图位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!