2022-06-01(设置缩进实现图片嵌入展示)

图片.png
[self.avatarImgView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.leading.equalTo(self.coverImgView);
    make.top.equalTo(self.coverImgView.mas_bottom).offset(8);
    make.width.height.mas_equalTo(18);
}];

[self.describeLab mas_makeConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(self.avatarImgView).offset(2);
    make.leading.equalTo(self.avatarImgView);
    make.trailing.equalTo(self.joinBtn.mas_leading).offset(-12);
}];

NSString *describe = @"1234567890asdfghjk";
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
paragraph.lineSpacing = 5; //设置行高
paragraph.firstLineHeadIndent = 22; //设置首行缩进避开头像
NSAttributedString *attStr = [[NSAttributedString alloc] initWithString:describe attributes:@{NSParagraphStyleAttributeName:paragraph}];
self.describeLab.attributedText = attStr;

https://blog.csdn.net/jameskaron/article/details/84909220

你可能感兴趣的:(2022-06-01(设置缩进实现图片嵌入展示))