Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13 - viewDidLayoutSubviews called on changing frame

There is some change done in viewdidlayoutsubviews in iOS 13 that is causing it to be called later in the life cycle of the View Controller once it has finished its first callings (on changing frame). This is creating some weird effects in the apps.

What I have observed is that before iOS13 changing frames do not call viewdidlayoutsubviews while in new iOS 13 it gets called.

Is this some kind of new feature by Apple or some bug? Any suggestions on how to stop this behavior?

like image 619
Hassy Avatar asked Sep 25 '19 08:09

Hassy


1 Answers

I'm facing that issue only for an UIViewController which will be added as a child of a Container View Controller. The device was not rotated - these are just the methods which will be called if the UIViewController was initial added to the hierarchy:

iOS 12:

  1. viewDidLayoutSubviews
  2. viewDidAppear

iOS 13:

  1. viewDidAppear
  2. viewDidLayoutSubviews

For me, that's not a feature hence it does not make sense calling viewDidLayoutSubviews after viewDidAppear (if the device was not rotated). Looks like a bug on iOS 13.

like image 115
charlyatwork Avatar answered Sep 28 '22 09:09

charlyatwork