This commit is contained in:
2026-01-28 13:43:36 +08:00
parent 51b744ecd7
commit 7d583ceb1d
14 changed files with 152 additions and 36 deletions

View File

@@ -26,11 +26,6 @@
return @{@"replies" : [KBAIReplyModel class]};
}
- (void)setLiked:(NSInteger)liked {
// NSInteger (0/1) BOOL
_isLiked = (liked == 1);
}
- (void)setCreatedAt:(NSString *)createdAt {
//
if (createdAt && createdAt.length > 0) {
@@ -44,6 +39,28 @@
}
}
#pragma mark - MJExtension Hook
/// MJExtension
- (void)mj_didConvertToObjectWithKeyValues:(NSDictionary *)keyValues {
// null
if (!_commentId) {
_commentId = @"";
}
if (!_userId) {
_userId = @"";
}
if (!_userName) {
_userName = @"";
}
if (!_avatarUrl) {
_avatarUrl = @"";
}
if (!_content) {
_content = @"";
}
}
- (instancetype)init {
self = [super init];
if (self) {
@@ -133,7 +150,8 @@
//
UIFont *contentFont = [UIFont systemFontOfSize:15];
CGRect contentRect = [self.content boundingRectWithSize:CGSizeMake(contentWidth, CGFLOAT_MAX)
NSString *contentText = self.content ?: @"";
CGRect contentRect = [contentText boundingRectWithSize:CGSizeMake(contentWidth, CGFLOAT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:@{NSFontAttributeName: contentFont}
context:nil];