From the documentation:
viewWillAppear:
Notifies the view controller that its view is about to be added to a view hierarchy.
viewDidAppear:
Notifies the view controller that its view was added to a view hierarchy.
As a result the frames of the subviews aren’t yet set in the viewWillAppear
:
The appropriate method to modify your UI before the view is presented to the screen is:
viewDidLayoutSubviews
Notifies the view controller that its view just laid out its subviews.