gsdios / SDAutoLayout

One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based on runtime.
MIT License
5.9k stars 1.28k forks source link

updateLayout 不应该直接调用 layoutSubviews #343

Open jiaopen opened 3 years ago

jiaopen commented 3 years ago

You should not call this method directly. If you want to force a layout update, call the setNeedsLayout() method instead to do so prior to the next drawing update. If you want to update the layout of your views immediately, call the layoutIfNeeded() method.

引用苹果文档原文https://developer.apple.com/documentation/uikit/uiview/1622482-layoutsubviews 这里改成这样会不会好一些?

[self.superView setNeedsLayout];
[self.superView layoutIfNeeded];