In the question "When does layoutSubviews get called?" several cases are listed:
- The parent view is resized
- The device is rotated
- Any more?
If there is no requirement to handle, for UITableView
, we can create a header view for the section header by creating one customized UIView
. The simplest way is to create the UIView
by initWithFrame:
and then there is no need to relayout any more.
Therefore, in my opinion, we do not need override layoutSubviews
etc. But there are some opinions to insist overriding it.
Reasons to not use it:
- KISS (keep it simple and stupid )
- No requirement for relayout
- Relayout has cost when scrolling
My question here is to get more suggestions for this case. Thanks.