Autolayout (Masonry) and Frame conflict problem

Reference: Apple's official website article Understanding Auto Layout

Summarize

  • Adding constraints does not take effect immediately, it will be loaded Autolayout (Masonry)at the right timeFrame , and the value read at this time is still the previous value
  • Autolayout (Masonry)After the constraint is added and modified, it will be modified Frameat the right timeFrame , causing the modification behavior to become invalid
  • means setting Frameand Autolayout (Masonry)constraining at the same time, what ends up on the screen is what the constraints are supposed to look like, it's worth reminding that changing Framedoesn't change Autolayout (Masonry)the constraints

suitable time

insert image description here
insert image description here

  • Of course, in addition to these, you can also manually call refresh

AutoLayout Constraints Auto Layout

The layout system of the view is determined by a series of linear equations ( Cassowarylayout algorithm), each constraint can be regarded as a representation of an equation, AutoLayoutand the performance bottleneck is the efficiency of Cassowarysolving multiple equations

Guess you like

Origin blog.csdn.net/weixin_46926959/article/details/128320104