// // ASGiftCardTableView.m // Asteria // // Created by iOS on 2023/11/3. // #import "ASGiftCardTableView.h" #import "ASGiftCardAvailabelCell.h" @interface ASGiftCardTableView () @end @implementation ASGiftCardTableView - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { self = [super initWithFrame:frame style:style]; if (self) { [self configSelf]; } return self; } - (void)configSelf { [self baseSet]; self.backgroundColor = UIColor.clearColor; [self registerClass:[ASGiftCardAvailabelCell class] forCellReuseIdentifier:@"ASGiftCardAvailabelCell"]; self.delegate = self; self.dataSource = self; self.alwaysBounceVertical = true; self.showsVerticalScrollIndicator = false; } // MARK: - delegate,datasource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.dataArr.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ASGiftCardAvailabelCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASGiftCardAvailabelCell" forIndexPath:indexPath]; if (self.dataArr.count <= indexPath.row) { return cell; } ASGiftCardModel *m = self.dataArr[indexPath.row]; [cell setData:m]; return cell; } @end