问题
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
- 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 Use Autolayout checkbox
- Rerun your code
来源:https://stackoverflow.com/questions/15597404/uilabel-updates-resets-view-positions