Misplaced views each time Xcode restarts Misplaced views each time Xcode restarts xcode xcode

Misplaced views each time Xcode restarts


This generally happens when you have not set the constraints properly.

Try removing all views inside the UIViewController and adding newly again along with your constraints.

Clean and run your code.


One possible reason for misplaced views is:If you have used live views(IBDesignables) in storyboards then if you open the storyboard and quickly move to some other file before the IB has finished building all the live views then the the views get misplaced. The IB starts building the live views as soon as you view the story board in the editor. To fix the misplaced views, allow IB some time to finish building the storyboard by staying on the storyboard for few moments, and the misplaced views will get fixed.


In my case it happens for all labels / buttons with custom fonts and intrinsic (not explicitly defined) sizes. Looks like an Xcode bug.