CommentListTableViewCell.m 1.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//
//  CommentListTableViewCell.m
//  Lighting
//
//  Created by 曹云霄 on 2016/12/12.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "CommentListTableViewCell.h"

@implementation CommentListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
15
    
16
    self.bestView = [[BestReplyView alloc] init];
17
    [self.contentView addSubview:self.bestView];
18 19 20 21 22
    [self.bestView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.optionButton.mas_left).offset(-5);
        make.size.mas_equalTo(CGSizeMake(0, 30));
        make.centerY.equalTo(self.optionButton);
    }];
23 24
}

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#pragma mark - 选项按钮
- (IBAction)extensionButtonClickAction:(UIButton *)sender {
    
    if (self.bestView.width) {
        [UIView animateWithDuration:0.2 animations:^{
            self.bestView.width = 0;
            self.bestView.x = self.optionButton.x;
        }];
    }else {
        [UIView animateWithDuration:0.2 animations:^{
            self.bestView.width = 90;
            self.bestView.x -= 100;
        }];
    }
}
40

41 42 43 44 45
#pragma mark - 赋值
- (void)setReplyEntity:(CustomTOForumReplyEntity *)replyEntity
{
    _replyEntity = replyEntity;
    self.bestView.replyId = _replyEntity.fid;
46
    [self.issuerImageView sd_setImageWithURL:[NSURL URLWithString:_replyEntity.replyerPicture] placeholderImage:ReplaceImage];
47 48 49 50
    self.issuerNameLabel.text = [NSString stringWithFormat:@"%@: %@",_replyEntity.replyerPosition,_replyEntity.replyerRealName];
    self.issuerDateLabel.text = _replyEntity.replyTime;
    self.commentContentLabel.text = _replyEntity.replyContent;
    self.bestView.isBest = _replyEntity.best;
51
    self.bestView.indexPath = self.indexPath;
52
    self.baseImageView.hidden = !_replyEntity.best;
53 54 55
}

@end