Files
yuyin_ios/SweetParty/主类/TXIM消息/TXHongbaoCellData.m

38 lines
1.4 KiB
Mathematica
Raw Permalink Normal View History

2025-08-08 11:05:33 +08:00
//
// TXHongbaoCellData.m
// romantic
//
// Created by bj_szd on 2022/9/6.
// Copyright © 2022 romantic. All rights reserved.
//
#import "TXHongbaoCellData.h"
@implementation TXHongbaoCellData
+ (TUIMessageCellData *)getCellData:(V2TIMMessage *)message{
NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil];
TXHongbaoCellData *cellData = [[TXHongbaoCellData alloc] initWithDirection:message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming];
cellData.msgID = message.msgID;
cellData.text = param[@"text"];
cellData.avatarUrl = [NSURL URLWithString:message.faceURL];
return cellData;
}
+ (NSString *)getDisplayString:(V2TIMMessage *)message {
NSDictionary *param = [NSJSONSerialization JSONObjectWithData:message.customElem.data options:NSJSONReadingAllowFragments error:nil];
return param[@"text"];
}
- (CGSize)contentSize {
// CGFloat textMaxWidth = 200.f;
// CGRect rect = [self.text boundingRectWithSize:CGSizeMake(textMaxWidth, MAXFLOAT)
// options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
// attributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:15] }
// context:nil];
CGSize size = CGSizeMake(220, 80);
return size;
}
@end