Why viewDidLayoutSubviews and viewWillLayoutSubviews is not getting called in view controller

222 Views Asked by At

I have a viewcontoller Called P. Whenever I rotate the screen , viewDidLayoutSubviews is getting called in P.

But sometimes it's not getting called in P and I don't why it happens like that and I don't know how to fix this issue.

Here is the scenario when it's not getting called.

My view controller pushes another view controller called A on top of P.

When I pop the view controller A and suddently I steer the ipad from Portrait to landscape , then viewDidLayoutSubviews and viewWillLayoutSubviews is not getting called at that moment. but when I change the orientation again these life cycle events are getting called.

When it's not getting called , in UI the elements are not arranged properly

Any ideas how to fix this ?

0

There are 0 best solutions below