房间内公聊大厅
This commit is contained in:
@@ -30,13 +30,34 @@
|
||||
if (!messageText) {
|
||||
messageText = YMLocalizedString(@"MessageTextModel0");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CGFloat width = [UILabel getWidthWithText:messageText height:kGetScaleWidth(36) font:kFontMedium(14)];
|
||||
|
||||
width = width > kGetScaleWidth(200) ? kGetScaleWidth(200) : width;
|
||||
self.width = width >= kGetScaleWidth(220) ? kGetScaleWidth(220) : (width + kGetScaleWidth(25));
|
||||
CGFloat height = [UILabel getLabelHeightWithText:messageText width:width font:kFontMedium(14)] + kGetScaleWidth(25);
|
||||
self.imageHeight = height;
|
||||
self.height = (self.isSelf ? kGetScaleWidth(35) : kGetScaleWidth(65)) + height;
|
||||
|
||||
|
||||
CGSize dstRect = CGSizeMake(width, MAXFLOAT);
|
||||
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
|
||||
NSMutableAttributedString * attribute = [faceManager attributedStringByText:messageText font:kFontMedium(14)];
|
||||
if(extModel.iosBubbleUrl.length > 0){
|
||||
[attribute addAttributes:@{NSForegroundColorAttributeName: UIColorFromRGB(0x333333)} range:[attribute.string rangeOfString:attribute.string]];
|
||||
}else{
|
||||
[attribute addAttributes:@{NSForegroundColorAttributeName:self.isSelf ? UIColorFromRGB(0x333333) : [UIColor whiteColor]} range:[attribute.string rangeOfString:attribute.string]];
|
||||
}
|
||||
|
||||
self.textAttribute = attribute;
|
||||
YYTextContainer *container = [YYTextContainer containerWithSize:dstRect];
|
||||
container.maximumNumberOfRows = 0;
|
||||
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:attribute];
|
||||
CGFloat rowHeight = layout.textBoundingSize.height + kGetScaleWidth(25);
|
||||
self.imageHeight = rowHeight;
|
||||
self.height = (self.isSelf ? kGetScaleWidth(35) : kGetScaleWidth(65)) + rowHeight;
|
||||
|
||||
self.isHiddenAvatar = YES;
|
||||
}
|
||||
|
Reference in New Issue
Block a user