当字体变大时如何将一个约束优先于另一个约束
How to prioritize one constraint over another when the font gets larger
我有一个具有以下约束的 UILabel:
- Align Center Y to Superview (priority 750)
- Top Space to View, greater than equal to 0 (priority 1000)
在正常模式下,UILabel
是 align center to Y
没问题。但是,如果我转到 Accessibility
设置并设置为大字体(最大尺寸),我希望我的标签使用大于等于的 Top Space
。
目前在这两种情况下仍在使用Align Center to Y
。有没有办法在字体很大时使用其他优先级更高的约束?
PS: 在这个标签下面还有另外两个标签,当字体变大时会缩小,因为顶视图标签停留在屏幕中间而不是向上移动。
试试这个
- Bottom space to view, equal to zero (multiplier 2)
- Top Space to View, greater than equal to 0
截图
项目 - https://github.com/leninsmannath/AutoLayoutBottomFromCenter.git
我有一个具有以下约束的 UILabel:
- Align Center Y to Superview (priority 750)
- Top Space to View, greater than equal to 0 (priority 1000)
在正常模式下,UILabel
是 align center to Y
没问题。但是,如果我转到 Accessibility
设置并设置为大字体(最大尺寸),我希望我的标签使用大于等于的 Top Space
。
目前在这两种情况下仍在使用Align Center to Y
。有没有办法在字体很大时使用其他优先级更高的约束?
PS: 在这个标签下面还有另外两个标签,当字体变大时会缩小,因为顶视图标签停留在屏幕中间而不是向上移动。
试试这个
- Bottom space to view, equal to zero (multiplier 2)
- Top Space to View, greater than equal to 0
截图
项目 - https://github.com/leninsmannath/AutoLayoutBottomFromCenter.git