解决方法:高度固定,等比例显示宽度
示例代码如下:
UIImage *picture = [UIImage imageNamed:model.picture];
_pictureView.image = picture;
// 等比例计算尺寸
CGFloat pHeight = 150;
CGFloat pWidth = picture.size.width * pHeight / picture.size.height;
//添加约束
[_pictureView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lContent.mas_bottom).offset(margin);
make.left.equalTo(lContent);
make.size.mas_equalTo(CGSizeMake(pWidth, pHeight));
}];
网友评论