// // YOUPAILZProfileMenuItemCell.m // MEISHI // // Created by CY on 2021/1/12. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAILZProfileMenuItemCell.h" #import "YOUPAIHRMedalView.h" #import "YOUPAIProfileMenuItemContentCell.h" @interface YOUPAILZProfileMenuItemCell () @end @implementation YOUPAILZProfileMenuItemCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = LZFAFAFCColor; [self youpaifinitUI]; } return self; } -(void)youpaifinitUI{ UIView *bgView = [UIView new]; [self.contentView addSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(12); make.right.mas_equalTo(-12); make.top.mas_equalTo(10); make.bottom.mas_equalTo(-10); }]; bgView.backgroundColor = [UIColor whiteColor]; bgView.layer.cornerRadius = 12; bgView.clipsToBounds = YES; bgView.userInteractionEnabled = YES; UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain]; [bgView addSubview:tableView]; [tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(0); }]; tableView.backgroundColor = [UIColor whiteColor]; tableView.showsVerticalScrollIndicator = NO; tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.estimatedRowHeight = 71.0f; tableView.rowHeight = 71.0f; tableView.delegate = self; tableView.dataSource= self; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSMutableDictionary *cellData = self.countArr[indexPath.item]; NSString *title = [cellData valueForKey:@"type"]; if (self.vqupaipDidSelectBlock) { self.vqupaipDidSelectBlock(title); } } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.countArr.count; } -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSMutableDictionary *cellData = self.countArr[indexPath.row]; NSString *cellID = @"YOUPAIProfileMenuItemContentCell"; YOUPAIProfileMenuItemContentCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; cell = [[YOUPAIProfileMenuItemContentCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; cell.youpaipimgV.image = [cellData valueForKey:@"image"]; cell.youpaiptextL.text = [cellData valueForKey:@"title"]; cell.youpaiplz_accessoryType = [[cellData valueForKey:@"accessoryType"] integerValue]; cell.youpaiprightLabel.text = [cellData valueForKey:@"rightText"]; cell.youpaipsubTextL.text = @""; cell.youpaipisShow = cellData[@"redView"]; if ([cellData.allKeys containsObject:@"subTitle"]) { cell.youpaipsubTextL.text = cellData[@"subTitle"]; } if (indexPath.row == self.countArr.count-1) { cell.line.hidden = YES; }else{ cell.line.hidden = NO; } return cell; } @end