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

有哪几种布局方式 #142

Open
tbfungeek opened this issue Feb 19, 2020 · 0 comments
Open

有哪几种布局方式 #142

tbfungeek opened this issue Feb 19, 2020 · 0 comments

Comments

@tbfungeek
Copy link
Owner

tbfungeek commented Feb 19, 2020

目前主要有三种方式:

  • 基于frame的布局,这是最原始的,也是效率最高的方式。
  • 基于autoresizingMask的布局,这种方式仅适用于约束父子控件之间的关系,不能设置兄弟视图之间的关系,当然也不能设置完全不相关的两个视图之间的关系。当UIView的autoresizesSubviews是YES时, 那么一旦bounds发生了变化,当前view的子view会根据它自身的autoresizingMask属性来自动适应其与superView之间的位置和大小。
  • 基于AutoLayout的布局,这种会把每个约束条件看成一个多元一次方程,一个视图往往有多条约束,这样每个视图都会形成一个多元一次方程组,这些方程组作为布局引擎的输入,经过布局引擎计算后得到视图的frame数据。再进入布局流程,完成整个页面的布局。
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