ASGiftCardTableView.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // ASGiftCardTableView.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/11/3.
  6. //
  7. #import "ASGiftCardTableView.h"
  8. #import "ASGiftCardAvailabelCell.h"
  9. @interface ASGiftCardTableView ()<UITableViewDelegate,UITableViewDataSource>
  10. @end
  11. @implementation ASGiftCardTableView
  12. - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
  13. self = [super initWithFrame:frame style:style];
  14. if (self) {
  15. [self configSelf];
  16. }
  17. return self;
  18. }
  19. - (void)configSelf {
  20. [self baseSet];
  21. self.backgroundColor = UIColor.clearColor;
  22. [self registerClass:[ASGiftCardAvailabelCell class] forCellReuseIdentifier:@"ASGiftCardAvailabelCell"];
  23. self.delegate = self;
  24. self.dataSource = self;
  25. self.alwaysBounceVertical = true;
  26. self.showsVerticalScrollIndicator = false;
  27. }
  28. // MARK: - delegate,datasource
  29. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  30. return self.dataArr.count;
  31. }
  32. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  33. ASGiftCardAvailabelCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASGiftCardAvailabelCell" forIndexPath:indexPath];
  34. if (self.dataArr.count <= indexPath.row) {
  35. return cell;
  36. }
  37. ASGiftCardModel *m = self.dataArr[indexPath.row];
  38. [cell setData:m];
  39. return cell;
  40. }
  41. @end