Skip to content

updateLayout 不应该直接调用 layoutSubviews  #343

@jiaopen

Description

@jiaopen

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];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions