Files
peko-ios/YuMi/Modules/YMMonents/View/Cell/XPMonentsReplyMoreTableViewCell.m
2024-04-11 17:05:27 +08:00

71 lines
2.1 KiB
Objective-C

//
// YMMonentsReplyMoreTableViewCell.m
// YUMI
//
// Created by YUMI on 2022/6/23.
//
#import "XPMonentsReplyMoreTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "DJDKMIMOMColor.h"
#import "XPMonentsLayoutConfig.h"
@interface XPMonentsReplyMoreTableViewCell ()
///查看更多
@property (nonatomic,strong) UILabel *moreLabel;
@end
@implementation XPMonentsReplyMoreTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.moreLabel];
}
- (void)initSubViewConstraints {
[self.moreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.top.bottom.mas_equalTo(self.contentView);
make.leading.mas_equalTo(self.contentView).offset(kMONENTS_COMMENT_REPLY_LEFT_PADDING + KMONENTS_COMMENT_REPLY_AVATAR_WIDTH + kMONENTS_COMMENT_AVATAR_NICK_PADDING);
}];
}
#pragma mark - Event Response
- (void)moreLabelTapRecognizer {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsReplyMoreTableViewCellDidClickMoreReply:)]) {
[self.delegate xPMonentsReplyMoreTableViewCellDidClickMoreReply:self];
}
}
#pragma mark - Getters And Setters
- (void)setLeftCount:(NSInteger)leftCount {
_leftCount = leftCount;
if (_leftCount) {
self.moreLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPMonentsReplyMoreTableViewCell0"), _leftCount];
}
}
- (UILabel *)moreLabel {
if (!_moreLabel) {
_moreLabel = [[UILabel alloc] init];
_moreLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightBold];
_moreLabel.textColor = [DJDKMIMOMColor appEmphasizeColor];
_moreLabel.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(moreLabelTapRecognizer)];
[_moreLabel addGestureRecognizer:tap];
}
return _moreLabel;
}
@end