cdts/xdts-ios 3/Pods/TUIChat/MyVipCarDatas.m

43 lines
1.4 KiB
Mathematica
Raw Permalink Normal View History

2023-07-27 09:20:00 +08:00
//
// 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