处理二级评论回复用户名称显示问题

This commit is contained in:
2026-02-04 18:29:12 +08:00
parent ff4edab820
commit 3ed120106e
3 changed files with 10 additions and 6 deletions

View File

@@ -55,9 +55,9 @@
if (!_content) { if (!_content) {
_content = @""; _content = @"";
} }
if ([_content isEqualToString:@"78910"]) { // if ([_content isEqualToString:@"78910"]) {
NSLog(@"==="); // NSLog(@"===");
} // }
if (!_replyToUserName) { if (!_replyToUserName) {
_replyToUserName = @""; _replyToUserName = @"";
} }

View File

@@ -33,6 +33,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, nullable) NSArray<KBCommentItem *> *replies; @property (nonatomic, strong, nullable) NSArray<KBCommentItem *> *replies;
/// 回复数量 /// 回复数量
@property (nonatomic, assign) NSInteger replyCount; @property (nonatomic, assign) NSInteger replyCount;
/// 被回复的用户 ID仅二级回复场景可能存在
@property (nonatomic, strong, nullable) NSNumber *replyToUserId;
/// 被回复的用户名(@xxx仅二级回复场景可能存在
@property (nonatomic, copy, nullable) NSString *replyToUserName;
/// 用户头像 /// 用户头像
@property (nonatomic, copy, nullable) NSString *userAvatar; @property (nonatomic, copy, nullable) NSString *userAvatar;
/// 用户 ID /// 用户 ID

View File

@@ -98,7 +98,7 @@
NSDictionary *nameAttrs = @{ NSDictionary *nameAttrs = @{
NSFontAttributeName : [UIFont systemFontOfSize:13 weight:UIFontWeightMedium], NSFontAttributeName : [UIFont systemFontOfSize:13 weight:UIFontWeightMedium],
NSForegroundColorAttributeName : [UIColor secondaryLabelColor] NSForegroundColorAttributeName : [UIColor whiteColor]
}; };
[attrName appendAttributedString:[[NSAttributedString alloc] [attrName appendAttributedString:[[NSAttributedString alloc]
initWithString:reply.userName initWithString:reply.userName
@@ -106,7 +106,7 @@
NSDictionary *replyAttrs = @{ NSDictionary *replyAttrs = @{
NSFontAttributeName : [UIFont systemFontOfSize:13], NSFontAttributeName : [UIFont systemFontOfSize:13],
NSForegroundColorAttributeName : [UIColor secondaryLabelColor] NSForegroundColorAttributeName : [UIColor whiteColor]
}; };
[attrName appendAttributedString:[[NSAttributedString alloc] [attrName appendAttributedString:[[NSAttributedString alloc]
initWithString:@" 回复 " initWithString:@" 回复 "
@@ -114,7 +114,7 @@
NSDictionary *toUserAttrs = @{ NSDictionary *toUserAttrs = @{
NSFontAttributeName : [UIFont systemFontOfSize:13], NSFontAttributeName : [UIFont systemFontOfSize:13],
NSForegroundColorAttributeName : [UIColor systemBlueColor] NSForegroundColorAttributeName : [UIColor whiteColor]
}; };
[attrName appendAttributedString:[[NSAttributedString alloc] [attrName appendAttributedString:[[NSAttributedString alloc]
initWithString:[NSString stringWithFormat:@"@%@", reply.replyToUserName] initWithString:[NSString stringWithFormat:@"@%@", reply.replyToUserName]