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

@@ -35,7 +35,7 @@
#pragma mark - UI Setup
- (void)setupUI {
self.contentView.backgroundColor = [UIColor whiteColor];
self.contentView.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.userNameLabel];
@@ -47,7 +47,7 @@
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16);
make.top.equalTo(self.contentView).offset(12);
make.width.height.mas_equalTo(40);
make.width.height.mas_equalTo(28);
}];
[self.userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -98,12 +98,11 @@
comment.likeCount > 0 ? [self formatLikeCount:comment.likeCount] : @"赞";
self.likeButton.textLabel.text = likeText;
UIImage *likeImage = comment.isLiked
? [UIImage systemImageNamed:@"heart.fill"]
: [UIImage systemImageNamed:@"heart"];
UIImage *likeImage = comment.liked
? [UIImage imageNamed:@"comment_sel_icon"]
: [UIImage imageNamed:@"comment_nor_icon"];
self.likeButton.iconView.image = likeImage;
self.likeButton.iconView.tintColor =
comment.isLiked ? [UIColor systemRedColor] : [UIColor grayColor];
}
- (NSString *)formatLikeCount:(NSInteger)count {
@@ -135,7 +134,7 @@
if (!_avatarImageView) {
_avatarImageView = [[UIImageView alloc] init];
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
_avatarImageView.layer.cornerRadius = 20;
_avatarImageView.layer.cornerRadius = 14;
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.backgroundColor = [UIColor systemGray5Color];
}
@@ -145,8 +144,9 @@
- (UILabel *)userNameLabel {
if (!_userNameLabel) {
_userNameLabel = [[UILabel alloc] init];
_userNameLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_userNameLabel.textColor = [UIColor secondaryLabelColor];
_userNameLabel.text = @"--";
_userNameLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
_userNameLabel.textColor = [UIColor colorWithHex:0x9F9F9F];
}
return _userNameLabel;
}
@@ -154,8 +154,8 @@
- (UILabel *)contentLabel {
if (!_contentLabel) {
_contentLabel = [[UILabel alloc] init];
_contentLabel.font = [UIFont systemFontOfSize:15];
_contentLabel.textColor = [UIColor labelColor];
_contentLabel.font = [UIFont systemFontOfSize:12];
_contentLabel.textColor = [UIColor whiteColor];
_contentLabel.numberOfLines = 0;
}
return _contentLabel;
@@ -165,7 +165,7 @@
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.font = [UIFont systemFontOfSize:12];
_timeLabel.textColor = [UIColor secondaryLabelColor];
_timeLabel.textColor = [UIColor colorWithHex:0x9F9F9F];
}
return _timeLabel;
}
@@ -175,7 +175,7 @@
_replyButton = [UIButton buttonWithType:UIButtonTypeCustom];
_replyButton.titleLabel.font = [UIFont systemFontOfSize:12];
[_replyButton setTitle:@"回复" forState:UIControlStateNormal];
[_replyButton setTitleColor:[UIColor secondaryLabelColor] forState:UIControlStateNormal];
[_replyButton setTitleColor:[UIColor colorWithHex:0x9F9F9F] forState:UIControlStateNormal];
[_replyButton addTarget:self
action:@selector(replyButtonTapped)
forControlEvents:UIControlEventTouchUpInside];
@@ -188,10 +188,9 @@
_likeButton = [[KBTopImageButton alloc] init];
_likeButton.iconSize = CGSizeMake(20, 20);
_likeButton.spacing = 2;
_likeButton.iconView.image = [UIImage systemImageNamed:@"heart"];
_likeButton.iconView.tintColor = [UIColor grayColor];
_likeButton.textLabel.font = [UIFont systemFontOfSize:11];
_likeButton.textLabel.textColor = [UIColor grayColor];
_likeButton.iconView.image = [UIImage imageNamed:@"comment_nor_icon"];
_likeButton.textLabel.font = [UIFont systemFontOfSize:10];
_likeButton.textLabel.textColor = [UIColor colorWithHex:0xC5BEB4];
[_likeButton addTarget:self
action:@selector(likeButtonTapped)
forControlEvents:UIControlEventTouchUpInside];