当我使用自动布局时,我通常将对象附加到底部,而不是基线。但什么是——基线?我无法从苹果文档中找到好的答案,无论是在 SO 上。
来自here我只发现基线只是一条水平线,从下往上,但在中心 Y 线下方。
有人可以解释一下它是什么以及为什么有人应该使用它?对我来说,将 View 附加到底部要容易得多。
最佳答案
根据 Apple 文档,UILabel
或其他带有文本的 UI 元素的基线是“标签内文本的垂直对齐方式”。在 UIView
的文档中指出:
When you make a constraint to a view’s baseline attribute, Auto Layout uses the baseline of the view returned by this method. If that view does not have a baseline, Auto Layout uses the view’s bottom edge
关于ios - 什么是自动布局基线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48120678/