Layout happens after viewWillAppear . Do this in viewDidLayoutSubviews (in your view controller) or in layoutSubviews (in your custom view subclass). In any case, first call super first.
Another way is to format the layout by sending [view layoutIfNeeded] . Then you can add subviews and set their springs and struts. The system will execute the layout again (at normal times) because you added subviews.
source share