// // ASCouponsListViewController.m // Asteria // // Created by iOS on 2023/6/25. // #import "ASCouponsListViewController.h" #import "ASCouponListCell.h" @interface ASCouponsListViewController () @property (nonatomic, strong) UIView *colorBgV; @property (nonatomic, strong) UITableView *tableV; @end @implementation ASCouponsListViewController - (void)viewDidLoad { [super viewDidLoad]; [self loadSubVs]; [self configSubVs]; } - (void)configSubVs { self.titleStr = self.isCard ? @"My Giftcard" : @"Coupons"; [self setNavRightSearch:^{ }]; self.statusBgV.backgroundColor = _E0FFF5; self.customNavBar.backgroundColor = _F0FFFA; } // MARK: - loadSubVs - (void)loadSubVs { [self.view addSubview:self.colorBgV]; [self.view addSubview:self.tableV]; [self.colorBgV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.customNavBar.mas_bottom); make.leading.trailing.bottom.equalTo(self.view); }]; [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.customNavBar.mas_bottom); make.leading.trailing.bottom.equalTo(self.view); }]; dispatch_async(dispatch_get_main_queue(), ^{ [UIView viewAddHorColorBg:self.colorBgV colorArr:@[ (id)_E0FFF5.CGColor, (id)Col_FFF.CGColor ] startP:CGPointMake(0.5, 0.2) endP:CGPointMake(0.5, 1)]; }); } // MARK: - subVs - (UIView *)colorBgV { if (!_colorBgV) { UIView *v = [UIView baseV]; v.backgroundColor = Col_FFF; _colorBgV = v; } return _colorBgV; } - (UITableView *)tableV { if (!_tableV) { UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; [v baseSet]; v.backgroundColor = UIColor.clearColor; v.delegate = self; v.dataSource = self; [v registerClass:[ASCouponListCell class] forCellReuseIdentifier:@"ASCouponListCell"]; _tableV = v; } return _tableV; } // MARK: - UITableViewDelegate,UITableViewDataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 10; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ASCouponListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASCouponListCell" forIndexPath:indexPath]; __weak typeof(self) weakSelf = self; [cell setCopyCallBack:^{ [weakSelf.view makeToast:@"Code Copied"]; }]; return cell; } @end