MyDetailTableViewCell.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // MyDetailTableViewCell.m
  3. // DSH
  4. //
  5. // Created by 张毅成 on 2018/9/26.
  6. // Copyright © 2018 WZX. All rights reserved.
  7. //
  8. #import "MyDetailTableViewCell.h"
  9. @implementation MyDetailTableViewCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setDataWithModel:(NSDictionary *)dic {
  15. if ([NSStringFromClass([dic class]) isEqualToString:@"__NSCFConstantString"]) {
  16. self.labelDetail.hidden = true;
  17. self.imageViewIcon.hidden = true;
  18. self.labelTitle.text = (NSString *)dic;
  19. return;
  20. }
  21. NSString *imageName = dic[@"imageName"];
  22. self.labelTitle.text = dic[@"title"];
  23. self.labelDetail.text = dic[@"titleDetail"];
  24. self.imageViewIcon.hidden = true;
  25. if (imageName.length > 0) {
  26. self.imageViewIcon.hidden = false;
  27. self.imageViewIcon.image = [UIImage imageNamed:imageName];
  28. if ([imageName isEqualToString:@"我的-个人信息-详细-二维码"]) {
  29. self.imageViewIcon.layer.cornerRadius = 0;
  30. self.imageViewIcon.layer.masksToBounds = false;
  31. self.imageViewWidth.constant = 15;
  32. self.imageViewHeight.constant = 15;
  33. }else{
  34. self.imageViewHeight.constant = 32;
  35. self.imageViewWidth.constant = 32;
  36. self.imageViewIcon.layer.cornerRadius = 16;
  37. self.imageViewIcon.layer.masksToBounds = true;
  38. // [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:kUserHeadImageURL] placeholderImage:kUserDefaultHeadImage];
  39. }
  40. self.labelDetail.hidden = true;
  41. }else
  42. self.labelDetail.hidden = false;
  43. if ([self.labelTitle.text isEqualToString:@"我的会员"]) {
  44. self.labelDetail.text = @"您还不是会员~加入会员享特权";
  45. }
  46. }
  47. + (instancetype)cellWithTableView:(UITableView *)tableView {
  48. static NSString *ID = @"MyDetailTableViewCell";
  49. MyDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  50. if (cell == nil) {
  51. cell = [[[NSBundle mainBundle] loadNibNamed:ID owner:self options:nil] firstObject];
  52. }
  53. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  54. return cell;
  55. }
  56. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  57. [super setSelected:selected animated:animated];
  58. // Configure the view for the selected state
  59. }
  60. @end