1

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 ?

Lynx
  • 183
  • 10
Naveen
  • 47
  • 6
  • “then viewDidLayoutSubviews and viewWillLayoutSubviews is not getting called at that moment.” Does the whole app rotate at that moment? – matt Nov 11 '19 at 23:54
  • Yes the whole app rotates but I can see the eleements are arranged wrongly in the current view controller for example when it's on landscape .. the views are arranged like it's for portrait mode – Naveen Nov 11 '19 at 23:57
  • Is this an issue for every app? – matt Nov 12 '19 at 00:00
  • I think it could happen to any app.All we have to do is during push or pop just rotate the screenthis would happen – Naveen Nov 12 '19 at 00:51
  • The issue never happens with A it only happens with P – Naveen Nov 12 '19 at 00:58
  • “I think it could happen to any app.All we have to do is during push or pop just rotate the screenthis would happen” I think you should report that to Apple. If they don’t send you the event you should get, that’s their bug, not yours. – matt Nov 12 '19 at 01:57
  • Is there any other life cycle event or delegate method that I can use for the similar purpose ? – Naveen Nov 13 '19 at 14:09
  • you could probably try viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator – Durai Amuthan.H Nov 18 '19 at 10:40

0 Answers0