Layoutsubviews is the attribute method in UIView, that is, as long as it inherits from UIView, this method can be used, and this method is also very powerful, the following is his trigger time:
1. Init initialization does not trigger Layoutsubviews
2, Addsubview will trigger Layoutsubviews
3, set the view frame will trigger the layoutsubviews, of course, if the frame value has changed before and after the setting
4, rolling a uiscrollview will trigger layoutsubviews
5. Rotate screen will trigger the Layoutsubviews event on the parent UIView
6, change the size of a uiview will also trigger the parent UIView on the Layoutsubviews event
In these triggering situations, we can make the most of it, such as changing the data and so on, which is a very good way.
And we can also call it manually, i.e.
[Self setneedslayout];
Note: Calling Layoutsubviews also requires calling its parent class method, which is the
[Super Layoutsubviews]
Legend has it that if you do not call it, there will be strange problems.
On the use of ios:layoutsubviews