MyTableViewCell.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // MyTableViewCell.m
  3. // DSH
  4. //
  5. // Created by 张毅成 on 2018/9/26.
  6. // Copyright © 2018 WZX. All rights reserved.
  7. //
  8. #import "MyTableViewCell.h"
  9. @implementation MyTableViewCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTouchLabel)];
  13. [self.labelDetail addGestureRecognizer:tap];
  14. }
  15. - (void)setDataWithModel:(NSDictionary *)dic {
  16. self.labelTitle.text = dic[@"title"];
  17. self.labelDetail.text = dic[@"detail"];
  18. self.imageViewIcon.image = [UIImage imageNamed:dic[@"titleImage"]];
  19. if ([self.labelTitle.text isEqualToString:@"我的会员"]) {
  20. if (!kIsVip) {
  21. self.labelDetail.text = @"您还不是会员~加入会员享特权";
  22. }
  23. }
  24. }
  25. + (instancetype)cellWithTableView:(UITableView *)tableView AndIndex:(NSInteger)index {
  26. NSString *ID = [NSString stringWithFormat:@"MyTableViewCell%ld",(long)index];
  27. MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  28. if (cell == nil) {
  29. cell = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell" owner:self options:nil][index];
  30. }
  31. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  32. return cell;
  33. }
  34. - (void)didTouchLabel {
  35. if (self.blockDidTouchLabelDetail) {
  36. self.blockDidTouchLabelDetail();
  37. }
  38. }
  39. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  40. [super setSelected:selected animated:animated];
  41. // Configure the view for the selected state
  42. }
  43. @end