NSLayoutConstraint动态修改multiplier或constant

齐健柏
2023-12-01
//修改图片宽度比
[NSLayoutConstraint deactivateConstraints:@[self.logoAspect]];

self.logoAspect = [NSLayoutConstraint constraintWithItem:self.logoImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.logoImageView attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];

[NSLayoutConstraint activateConstraints:@[self.logoAspect]];

 

 类似资料: