- (void)setNeedsLayout;
Invalidates the current layout of the receiver and triggers a layout update during the next update cycle.
- (void)layoutIfNeeded;
Lays out the subviews immediately, if layout updates are pending.
-setNeedsLayout方法: 标记为需要重新布局,异步调用layoutIfNeeded刷新布局,不立即刷新,但layoutSubviews一定会被调用
-layoutIfNeeded方法: 如果,有需要刷新的标记,立即调用layoutSubviews进行布局(如果没有标记,不会调用layoutSubviews)
https://blog.csdn.net/meegomeego/article/details/39890385
https://blog.csdn.net/flytomyskyone/article/details/42709345