Solution
- Place that code in
viewDidAppear
Reason
viewDidLoad
happens before autolayout is completed. So the position is not yet set by autolayout that was specified in xibviewDidAppear
happens after autolayout is completed.
The answer is
[view layoutIfNeeded];
Solution
viewDidAppear
Reason
viewDidLoad
happens before autolayout is completed. So the position is not yet set by autolayout that was specified in xibviewDidAppear
happens after autolayout is completed.