Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateLayout 不应该直接调用 layoutSubviews #343

Open
jiaopen opened this issue Feb 7, 2021 · 0 comments
Open

updateLayout 不应该直接调用 layoutSubviews #343

jiaopen opened this issue Feb 7, 2021 · 0 comments

Comments

@jiaopen
Copy link

jiaopen commented Feb 7, 2021

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];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant