- leftAnchor:左边距
- rightAnchor:右边距
- topAnchor:上边距
- bottomAnchor:下边距
- widthAnchor:宽度
- heightAnchor:高度
- centerXAnchor:中心x
- centerYAnchor:中心y
- leadingAnchor:依赖语言环境设置,对于从左往右阅读语言,比如英语,leadingAnchor = leftAnchor,对于从右往左阅读语言,比如阿拉伯语,leadingAnchor = rightAnchor
- trailingAnchor:依赖语言环境设置,对于从左往右阅读语言,比如英语,trailingAnchor = rightAnchor,对于从右往左阅读语言,比如阿拉伯语,trailingAnchor = leftAnchor
- firstBaseLineAnchor:the baseline of the top row of text
- lastBaseLineAnchor:the baseline of the bottom row of text
leading/trailing 同 left/right的区别
This was covered (briefly) in one of the WWDC 2015 videos on the Mysteries of Autolayout (I think it was part 1 but both are worth watching).
left和right约束是绝对的,总是意指屏幕的左侧和右侧。leading和trailing约束和设备的语言环境有关系。苹果官方的建议是使用leading和trailing约束,如果是绝对布局并且不在意语言环境设置,可以使用left和right约束。