UILabel updates resets view positions

旧巷老猫 提交于 2019-12-11 02:22:57

问题


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?


回答1:


I ran into a similar issue. The solution was to turn off Autolayout

  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


来源:https://stackoverflow.com/questions/15597404/uilabel-updates-resets-view-positions

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