我有一个网页,它开始时的宽度限制是100。
当用户点击按钮时,我想将其更改为200。
我尝试过以下方法:
NSLayoutConstraint *constrain = [NSLayoutConstraint
constraintWithItem:self.webPage
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:self.webPage
attribute:NSLayoutAttributeWidth
multiplier:1
constant:100];
[self.webPage addConstraint:constrain];
但是这会抛出以下异常:
"无法同时满足约束条件。"
有什么想法吗?