// // MyTableViewCell.m // DSH // // Created by 张毅成 on 2018/9/26. // Copyright © 2018 WZX. All rights reserved. // #import "MyTableViewCell.h" @implementation MyTableViewCell - (void)awakeFromNib { [super awakeFromNib]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTouchLabel)]; [self.labelDetail addGestureRecognizer:tap]; } - (void)setDataWithModel:(NSDictionary *)dic { self.labelTitle.text = dic[@"title"]; self.labelDetail.text = dic[@"detail"]; self.imageViewIcon.image = [UIImage imageNamed:dic[@"titleImage"]]; if ([self.labelTitle.text isEqualToString:@"我的会员"]) { if (!kIsVip) { self.labelDetail.text = @"您还不是会员~加入会员享特权"; } } } + (instancetype)cellWithTableView:(UITableView *)tableView AndIndex:(NSInteger)index { NSString *ID = [NSString stringWithFormat:@"MyTableViewCell%ld",(long)index]; MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (cell == nil) { cell = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell" owner:self options:nil][index]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } - (void)didTouchLabel { if (self.blockDidTouchLabelDetail) { self.blockDidTouchLabelDetail(); } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end