There are lots of viewDidLayoutSubviews
events fired in my ViewController. Eventually I narrowed down to the single line of code which triggers the event:
self.debugLabel.text = [NSString stringWithFormat:@"%@ - %@", key, [@(tag) stringValue]];
Its a UILabel
in a subview added to self.view
of the ViewController. Why changing the text of a UILabel
will cause boundary changes? In viewDidLayoutSubviews
doc:
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.
p.s. I am sure the debugLabel font size is small enough to fit in its frame.
I believe this has to do with auto-layout. If a view resizes then the constraints need to be checked throughout the rest of the view hierarchy to ensure that they are satisfied.