39 lines
1018 B
Objective-C
39 lines
1018 B
Objective-C
//
|
|
// YMMessageInfoModel.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2022/10/21.
|
|
//
|
|
|
|
#import "XPMessageInfoModel.h"
|
|
#import "XPRoomMessageConstant.h"
|
|
|
|
|
|
|
|
@implementation XPMessageInfoModel
|
|
|
|
- (instancetype)init {
|
|
if ([super init]) {
|
|
self.contentLeftMargin = 12;
|
|
self.contentRightMargin = 0;
|
|
self.contentTopMargin = 10;
|
|
self.contentBottomMargin = 10;
|
|
self.cellBottomMargin = 6;
|
|
self.isUpdateContentFrame = NO;
|
|
self.isHiddenBubble = NO;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)setContent:(NSAttributedString *)content {
|
|
_content = content;
|
|
CGSize maxSize = CGSizeMake(kRoomMessageMaxWidth - self.contentLeftMargin - self.contentRightMargin - 12, MAXFLOAT);
|
|
YYTextContainer *container = [YYTextContainer containerWithSize:maxSize];
|
|
container.maximumNumberOfRows = 0;
|
|
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:self.content];
|
|
CGFloat rowHeight = layout.textBoundingSize.height + self.contentTopMargin + self.contentBottomMargin + self.cellBottomMargin;
|
|
self.rowHeight = rowHeight;
|
|
}
|
|
|
|
@end
|