ASPointsHomeViewController.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // ASPointsHomeViewController.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/6/19.
  6. //
  7. #import "ASPointsHomeViewController.h"
  8. #import "ASPointHeadView.h"
  9. #import "ASPointEranCell.h"
  10. #import "ASPointDetailViewController.h"
  11. @interface ASPointsHomeViewController ()<UITableViewDelegate,UITableViewDataSource>
  12. @property (nonatomic, strong) ASPointHeadView *headV;
  13. @property (nonatomic, strong) UITableView *tableV;
  14. @end
  15. @implementation ASPointsHomeViewController
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self loadSubVs];
  19. [self configSubV];
  20. }
  21. - (void)configSubV {
  22. [self setTitleStr:@"Points"];
  23. [self setNavRightSearch:^{
  24. // TODO: - to Search VC
  25. }];
  26. [self.headV setData:@"321241"];
  27. __weak typeof(self) weakSelf = self;
  28. [self.headV setRuleCallBack:^{
  29. UIViewController *vc = [CTMediator.sharedInstance getWebViewVc:@{
  30. @"title":@"Points Rules",
  31. @"url":@"https://baidu.com"
  32. }];
  33. [weakSelf.navigationController pushViewController:vc animated:true];
  34. }];
  35. [self.headV setDetailCallBack:^{
  36. ASPointDetailViewController *vc = [ASPointDetailViewController new];
  37. [weakSelf.navigationController pushViewController:vc animated:true];
  38. }];
  39. self.customNavBar.backgroundColor = _F0FFFA;
  40. }
  41. - (void)loadSubVs {
  42. [self.view addSubview:self.tableV];
  43. [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.top.equalTo(self.customNavBar.mas_bottom);
  45. make.leading.trailing.bottom.equalTo(self.view);
  46. }];
  47. }
  48. // MARK: - subVs
  49. - (ASPointHeadView *)headV {
  50. if (!_headV) {
  51. ASPointHeadView *v = [[ASPointHeadView alloc] initWithFrame:CGRectZero];
  52. _headV = v;
  53. }
  54. return _headV;
  55. }
  56. - (UITableView *)tableV {
  57. if (!_tableV) {
  58. UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  59. [v registerClass:[ASPointEranCell class] forCellReuseIdentifier:@"ASPointEranCell"];
  60. v.delegate = self;
  61. v.dataSource = self;
  62. [v baseSet];
  63. v.tableHeaderView = self.headV;
  64. _tableV = v;
  65. }
  66. return _tableV;
  67. }
  68. // MARK: - UITableViewDelegate,UITableViewDataSource
  69. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  70. return 10;
  71. }
  72. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  73. ASPointEranCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ASPointEranCell" forIndexPath:indexPath];
  74. [cell setData:@"Browsing hD Lace Wig Page ≥ 15 Seconds" des:@"1 Points Per $1 " status:indexPath.row%2 == 1];
  75. return cell;
  76. }
  77. @end