Assertion failure in -[MASViewConstraint addConstraintWithLayoutAttribute:],'Attributes should be ch

使用Masonry一不小心就会出现各种问题。

今天的问题大概是这样的:

Assertion failure in -[MASViewConstraint addConstraintWithLayoutAttribute:],

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attributes should be chained before defining the constraint relation'


控制台截图:

Assertion failure in -[MASViewConstraint addConstraintWithLayoutAttribute:],'Attributes should be ch_第1张图片



错误原因:

_operationButton 是一个按钮,添加了如下约束


图中红色圈中的width应该修改成with。这里不是设置宽度,是给当前的约束添加附加条件(我这里是偏移量),应该用介词with,而不是width。



你可能感兴趣的:(iOS)