iOS AutoLayout - get frame size width

The answer is

 [view layoutIfNeeded];

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 xib
  • viewDidAppear happens after autolayout is completed.