I was reading the description of viewDidLayoutSubviews
of UIViewController
:
Called to notify the view controller that its vi
viewDidLayoutSubviews
will be called when
When the bounds change for a view controller's view, the view adjusts the positions of its subviews and then the system calls this method.
For example you have set constraints
of your view then you want to update the frame for your subview in viewDidLoad()
, which will not make any impact as in viewDidLoad()
your constraints
are not properly set, they will get properly set when viewDidLayoutSubviews
get called, now you want to update the frames of your subview, then you can do that in this method as this method get called only after all the constraints of your view are properly set.