SPSBDisplayDiscountCouponViewController.m 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // SPSBDisplayDiscountCouponViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/5/24.
  6. //
  7. #import "SPSBDisplayDiscountCouponViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. #import "SPSBDiscountCouponTableViewController.h"
  10. #import <JXHFixHeaderViewController.h>
  11. #import <JXHFixHeaderViewHeaderController.h>
  12. #import <JXHClassifyView.h>
  13. @interface SPSBDisplayDiscountCouponViewController () {
  14. JXHFixHeaderViewController *_contentVC;
  15. NSArray<SPSBDiscountCouponTableViewController *> *_tableViews;
  16. }
  17. @end
  18. @implementation SPSBDisplayDiscountCouponViewController
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. [self setupUI];
  22. [_contentVC.jxh_bgScrollView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];
  23. }
  24. #pragma mark - Action
  25. #pragma mark - Network Action
  26. #pragma mark - UI
  27. - (void)setupUI {
  28. self.title = @"优惠券";
  29. [self createContentView];
  30. [self addClassifyView];
  31. [self createLists];
  32. }
  33. - (void)createLists {
  34. NSMutableArray *arr = NSMutableArray.new;
  35. for (NSInteger i = 0; i < 2; i ++) {
  36. SPSBDiscountCouponTableViewController *list = SPSBDiscountCouponTableViewController.new;
  37. list.spsb_viewType = SPSBDiscountCouponViewTypeDisplay;
  38. list.spsb_canUse = i == 0;
  39. [arr addObject:list];
  40. }
  41. _tableViews = arr;
  42. [_contentVC setListViews:_tableViews];
  43. }
  44. - (void)addClassifyView {
  45. JXHClassifyViewConfiguration *configuration = ({
  46. JXHClassifyViewConfiguration *configuration = JXHClassifyViewConfiguration.new;
  47. configuration.jxh_titleArray = @[@"未使用", @"已失效"];
  48. configuration.jxh_height = 50;
  49. configuration.jxh_font = spsb_font(16);
  50. configuration.jxh_normalColor = spsb_666666_color();
  51. configuration.jxh_selectedColor = spsb_3296FB_color();
  52. configuration.jxh_margen = 0.f;
  53. configuration.jxh_interval = 0.f;
  54. configuration.jxh_selectedViewSize = (CGSize){60, 2.5};
  55. configuration.jxh_selectedViewColor = spsb_3296FB_color();
  56. configuration.jxh_equalWidth = jxh_screenWidth() / 2;
  57. configuration.jxh_isNeedSelectedView = true;
  58. configuration;
  59. });
  60. [_contentVC setExteriorClassifyViewWithConfiguration:configuration];
  61. [self.view addSubview:_contentVC.jxh_classifyView];
  62. [_contentVC.jxh_classifyView makeConstraints:^(JXHConstraintMaker *make) {
  63. make.top.equalTo(self.view.safetop);
  64. make.leading.and.trailing.equalTo(0);
  65. make.height.equalTo(configuration.jxh_height);
  66. }];
  67. }
  68. - (void)createContentView {
  69. _contentVC = JXHFixHeaderViewController.new;
  70. [self addChildViewController:_contentVC];
  71. [self.view addSubview:_contentVC.view];
  72. [_contentVC.view makeConstraints:^(JXHConstraintMaker *make) {
  73. make.top.equalTo(self.view.safetop).offset(50);
  74. make.leading.and.trailing.and.bottom.equalTo(0);;
  75. }];
  76. JXHFixHeaderViewHeaderController *header = JXHFixHeaderViewHeaderController.new;
  77. [_contentVC setHeader:header];
  78. }
  79. @end