首页 > 解决方案 > 为什么`NSLayoutConstraint.multiplier`是只读的?

问题描述

这个决定背后的理由是什么,他们为什么这样做?

constantwhile 读写是怎么来的,whilemultiplier不是呢?

标签: iosmacosautolayoutuikit

解决方案


Updating the constant of a constraint can be done very efficiently and fast. Changing its multiplier on the other hand is much more complicated on the inside and basically produces the same amount of work than removing and adding a constraint.

The API reflects this complexity so that developers are aware that this is a more expensive operation.

Posted 20 hours ago by Frameworks Engineer https://developer.apple.com/forums/thread/655663


推荐阅读