ASCouponsListViewController.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // ASCouponsListViewController.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/25.
  6. //
  7. #import "ASCouponsListViewController.h"
  8. #import "ASCouponListCell.h"
  9. @interface ASCouponsListViewController () <UITableViewDelegate,UITableViewDataSource>
  10. @property (nonatomic, strong) UIView *colorBgV;
  11. @property (nonatomic, strong) UITableView *tableV;
  12. @end
  13. @implementation ASCouponsListViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. [self loadSubVs];
  17. [self configSubVs];
  18. }
  19. - (void)configSubVs {
  20. self.titleStr = self.isCard ? @"My Giftcard" : @"Coupons";
  21. [self setNavRightSearch:^{
  22. }];
  23. self.statusBgV.backgroundColor = _E0FFF5;
  24. self.customNavBar.backgroundColor = _F0FFFA;
  25. }
  26. // MARK: - loadSubVs
  27. - (void)loadSubVs {
  28. [self.view addSubview:self.colorBgV];
  29. [self.view addSubview:self.tableV];
  30. [self.colorBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.top.equalTo(self.customNavBar.mas_bottom);
  32. make.leading.trailing.bottom.equalTo(self.view);
  33. }];
  34. [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.top.equalTo(self.customNavBar.mas_bottom);
  36. make.leading.trailing.bottom.equalTo(self.view);
  37. }];
  38. dispatch_async(dispatch_get_main_queue(), ^{
  39. [UIView viewAddHorColorBg:self.colorBgV colorArr:@[
  40. (id)_E0FFF5.CGColor,
  41. (id)Col_FFF.CGColor
  42. ] startP:CGPointMake(0.5, 0.2) endP:CGPointMake(0.5, 1)];
  43. });
  44. }
  45. // MARK: - subVs
  46. - (UIView *)colorBgV {
  47. if (!_colorBgV) {
  48. UIView *v = [UIView baseV];
  49. v.backgroundColor = Col_FFF;
  50. _colorBgV = v;
  51. }
  52. return _colorBgV;
  53. }
  54. - (UITableView *)tableV {
  55. if (!_tableV) {
  56. UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  57. [v baseSet];
  58. v.backgroundColor = UIColor.clearColor;
  59. v.delegate = self;
  60. v.dataSource = self;
  61. [v registerClass:[ASCouponListCell class] forCellReuseIdentifier:@"ASCouponListCell"];
  62. _tableV = v;
  63. }
  64. return _tableV;
  65. }
  66. // MARK: - UITableViewDelegate,UITableViewDataSource
  67. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  68. return 10;
  69. }
  70. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  71. ASCouponListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASCouponListCell" forIndexPath:indexPath];
  72. __weak typeof(self) weakSelf = self;
  73. [cell setCopyCallBack:^{
  74. [weakSelf.view makeToast:@"Code Copied"];
  75. }];
  76. return cell;
  77. }
  78. @end