CommentListTableViewCell.m 1.78 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
#pragma mark - 选项按钮
- (IBAction)extensionButtonClickAction:(UIButton *)sender {
27
    if (self.bestView.width != 0) {
28 29 30 31 32 33 34 35 36 37 38
        [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;
        }];
    }
}
39

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

@end