您好我使用此方法创建子视图及其内部
UIImageView *imageView = [self centeredImageViewForImage:(UIImage *)content];
[imageView sizeToFit];
//imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:imageView];
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:imageView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:imageView
attribute:NSLayoutAttributeWidth
multiplier:1.0
constant:0]];
问题在于,当我给出一个巨大的宽度和低高度(如1000x100)时,这会在我的文本行和图像之间创建一个巨大的空间,我该如何消除它?
实施例;正确的观点http://tinypic.com/view.php?pic=20pbkvt&s=8#.VFVGyVuZO94 解散和不良观点http://tinypic.com/view.php?pic=148kjnl&s=8#.VFVGyluZO95
这是我的UILabel代码
UILabel *label = [self multilineLabelWithAttributedString:(NSAttributedString *)content];
[self.contentView addSubview:label];