YOUPAILZProfileMenuItemCell.m 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // YOUPAILZProfileMenuItemCell.m
  3. // MEISHI
  4. //
  5. // Created by CY on 2021/1/12.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZProfileMenuItemCell.h"
  9. #import "YOUPAIHRMedalView.h"
  10. #import "YOUPAIProfileMenuItemContentCell.h"
  11. @interface YOUPAILZProfileMenuItemCell ()<UITableViewDataSource,UITableViewDelegate>
  12. @end
  13. @implementation YOUPAILZProfileMenuItemCell
  14. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  15. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  16. self.selectionStyle = UITableViewCellSelectionStyleNone;
  17. self.backgroundColor = LZFAFAFCColor;
  18. [self youpaifinitUI];
  19. }
  20. return self;
  21. }
  22. -(void)youpaifinitUI{
  23. UIView *bgView = [UIView new];
  24. [self.contentView addSubview:bgView];
  25. [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.left.mas_equalTo(12);
  27. make.right.mas_equalTo(-12);
  28. make.top.mas_equalTo(10);
  29. make.bottom.mas_equalTo(-10);
  30. }];
  31. bgView.backgroundColor = [UIColor whiteColor];
  32. bgView.layer.cornerRadius = 12;
  33. bgView.clipsToBounds = YES;
  34. bgView.userInteractionEnabled = YES;
  35. UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
  36. [bgView addSubview:tableView];
  37. [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.edges.mas_equalTo(0);
  39. }];
  40. tableView.backgroundColor = [UIColor whiteColor];
  41. tableView.showsVerticalScrollIndicator = NO;
  42. tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  43. tableView.estimatedRowHeight = 71.0f;
  44. tableView.rowHeight = 71.0f;
  45. tableView.delegate = self;
  46. tableView.dataSource= self;
  47. }
  48. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  49. NSMutableDictionary *cellData = self.countArr[indexPath.item];
  50. NSString *title = [cellData valueForKey:@"type"];
  51. if (self.vqupaipDidSelectBlock) {
  52. self.vqupaipDidSelectBlock(title);
  53. }
  54. }
  55. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  56. return self.countArr.count;
  57. }
  58. -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  59. NSMutableDictionary *cellData = self.countArr[indexPath.row];
  60. NSString *cellID = @"YOUPAIProfileMenuItemContentCell";
  61. YOUPAIProfileMenuItemContentCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  62. cell = [[YOUPAIProfileMenuItemContentCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  63. cell.youpaipimgV.image = [cellData valueForKey:@"image"];
  64. cell.youpaiptextL.text = [cellData valueForKey:@"title"];
  65. cell.youpaiplz_accessoryType = [[cellData valueForKey:@"accessoryType"] integerValue];
  66. cell.youpaiprightLabel.text = [cellData valueForKey:@"rightText"];
  67. cell.youpaipsubTextL.text = @"";
  68. cell.youpaipisShow = cellData[@"redView"];
  69. if ([cellData.allKeys containsObject:@"subTitle"]) {
  70. cell.youpaipsubTextL.text = cellData[@"subTitle"];
  71. }
  72. if (indexPath.row == self.countArr.count-1) {
  73. cell.line.hidden = YES;
  74. }else{
  75. cell.line.hidden = NO;
  76. }
  77. return cell;
  78. }
  79. @end