UILayoutPriority

本文介绍了布局约束中的优先级概念,高优先级的约束会在低优先级的约束之前得到满足。默认优先级为必需,意味着该约束必须精确满足。布局系统会尽可能地满足可选约束,即使不能完全实现。通过优先级可以表达有用的条件行为,例如某些控件除非有更重要的需求,否则应始终调整大小以适应其内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Priority level. Constraints have a priority level. Constraints with higher priority levels are satisfied before constraints with lower priority levels. The default priority level is required (NSLayoutPriorityRequired), which means that the constraint must be satisfied exactly. The layout system gets as close as it can to satisfying an optional constraint, even if it cannot completely achieve it.
Priority levels allow you to express useful conditional behavior. For example, they are used to express that some controls should always be sized to fit their contents, unless something more important should take precedence. For more information about priority levels, see NSLayoutPriority.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值