// // MyVipCarDatas.m // TUICore // // Created by 末班车 on 2022/11/30. // #import "MyVipCarDatas.h" @implementation MyVipCarDatas + (NSString *)getDisplayString:(V2TIMMessage *)message { NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; return param[@"text"]; } + (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{ NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil]; MyVipCarDatas *cellData = [[MyVipCarDatas alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming]; cellData.innerMessage = message; cellData.msgID = message.msgID; cellData.text = param[@"text"]; cellData.detal = param[@"detal"]; cellData.avatarUrl = [NSURL URLWithString:message.faceURL]; return cellData; } - (CGSize)contentSize { // CGRect rect = [self.text boundingRectWithSize:CGSizeMake(300, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] } context:nil]; // CGSize size = CGSizeMake(ceilf(rect.size.width)+1, ceilf(rect.size.height)); // // // 加上气泡边距 // size.height += 60; // size.width += 20; // // return size; return CGSizeMake(205, 80); } @end