UILabel 更新重置视图位置 [英] UILabel updates resets view positions

查看:28
本文介绍了UILabel 更新重置视图位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更新 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

  1. 选择您的故事板(可能称为MainStoryboard.storyboard)
  2. 点击实用工具面板中的显示文件检查器(又名command + option + 0通过 command + option + 1)
  3. Interface Builder Document 部分,取消选中 Use自动布局复选框
  4. 重新运行代码
  1. Select your storyboard (probably called MainStoryboard.storyboard)
  2. Click on the Show the File inspector in the Utilities panel (aka command + option + 0 followed by command + option + 1)
  3. In the Interface Builder Document section uncheck the Use Autolayout checkbox
  4. Rerun your code

这篇关于UILabel 更新重置视图位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆