// // PayRecoderDetailViewController.m // 隐私保护 // // Created by APPLE on 2023/8/29. // #import "PayRecoderDetailViewController.h" @interface PayRecoderDetailViewController () @property (nonatomic, strong, nullable) UITableView *tableView; @end @implementation PayRecoderDetailViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self drawAnyView]; } - (void)drawAnyView{ [self.view setBackgroundColor:HWF5F7FAColor]; [self.toolBar setHidden:YES]; [self.navigationBar setHidden:YES]; [self.navBarBGView setHidden:NO]; [self.titleLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_cell_buy_detaile",nil)]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16); make.right.mas_equalTo(-16); make.bottom.mas_equalTo(0); make.top.equalTo(self.navBarBGView.mas_bottom).offset(4); }]; [self.tableView setTableHeaderView:[self tableHeaderView]]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ #pragma mark - 懒加载 - (UITableView *)tableView{ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStyleGrouped]; _tableView.delegate = self; _tableView.dataSource = self; _tableView.showsVerticalScrollIndicator = NO; _tableView.showsHorizontalScrollIndicator = NO; // _tableView.contentInset = UIEdgeInsetsMake(-20, 0, 0, 0); [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)]; [_tableView setSeparatorColor:[UIColor clearColor]]; [_tableView setBackgroundColor:[UIColor clearColor]]; [_tableView setTableFooterView:[UIView new]]; [_tableView setBounces:YES]; if (@available(iOS 15.0, *)) { _tableView.sectionHeaderTopPadding = 0; } } return _tableView; } #pragma mark - 列表委托 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSInteger row = indexPath.row; static NSString *identifier = @"BuyRecoderDetailCell"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier]; cell.selectionStyle = UITableViewCellSelectionStyleNone; if (!cell){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [cell setBackgroundColor:[UIColor clearColor]]; [cell setAccessoryType:(UITableViewCellAccessoryNone)]; [cell.textLabel setTextColor:HW666666Color]; [cell.textLabel setFont:[UIFont systemFontOfSize:12]]; [cell.detailTextLabel setTextColor:HW0A132BColor]; [cell.detailTextLabel setFont:[UIFont systemFontOfSize:12]]; [cell.detailTextLabel setTextAlignment:(NSTextAlignmentRight)]; [cell.contentView setBackgroundColor:HWFFFFFFColor]; } cell.contentView.layer.mask = nil; if (0 == row){ [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_buy_time",nil)]; [cell.detailTextLabel setText:@"2023-12-12 19:00:00"]; }else if (1 == row){ [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_expect_time",nil)]; [cell.detailTextLabel setText:@"2023-12-15 19:00:00"]; }else if (2 == row){ [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_order_number",nil)]; [cell.detailTextLabel setText:@"okrs0m9gyyoYS39733673768"]; }else if (3 == row){ [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_pay_states",nil)]; [cell.detailTextLabel setText:@"支付成功"]; }else if (4 == row){ [cell.textLabel setText:NSLocalizedString(@"buy_vip_buy_recoder_detaile_pay_type",nil)]; [cell.detailTextLabel setText:@"支付宝"]; UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W - 2*16.f, 35.f) byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(8, 8)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = cell.contentView.bounds; maskLayer.path = maskPath.CGPath; cell.contentView.layer.mask = maskLayer; } return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 35; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSInteger row = indexPath.row; } - (UIView *)tableHeaderView{ UIView *headView = [[UIView alloc] initWithFrame:(CGRectMake(0, 0, SCREEN_W - 2*16.f, 52.f))]; [headView setBackgroundColor:HWFFFFFFColor]; UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W - 2*16.f, 52.f) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = headView.bounds; maskLayer.path = maskPath.CGPath; headView.layer.mask = maskLayer; /*订单时间相关*/ UILabel *vipTypeLabel = [[UILabel alloc] init]; [vipTypeLabel setText:@"VIP30天"]; [vipTypeLabel setFont:[UIFont boldSystemFontOfSize:16]]; [vipTypeLabel setTextColor:HW0A132BColor]; [headView addSubview:vipTypeLabel]; [vipTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14.f); make.top.mas_equalTo(16); }]; /*价格标签*/ NSString *leftStr3 = @"¥"; NSString *rightStr3 = @"99.00"; UILabel *priceLabel = [[UILabel alloc] init]; [priceLabel setText:[leftStr3 stringByAppendingString:rightStr3]]; [priceLabel setFont:[UIFont boldSystemFontOfSize:16]]; [priceLabel setTextColor:HWDD4E4EColor]; [priceLabel setTextAlignment:(NSTextAlignmentRight)]; [headView addSubview:priceLabel]; [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-14.f); make.top.mas_equalTo(16); }]; /*分割线*/ UIView *line = [[UIView alloc] init]; [line setBackgroundColor:HW979797Color10]; [headView addSubview:line]; [line mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(14.f); make.right.mas_equalTo(-14.f); make.height.mas_equalTo(1.f); make.bottom.mas_equalTo(0); }]; return headView; } @end