autolayout 入门(二)

  • 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约束。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值