// // SPSBDisplayDiscountCouponViewController.m // 我的社保 // // Created by shanp on 2021/5/24. // #import "SPSBDisplayDiscountCouponViewController.h" #import "SPSBUIGeneralHeader.h" #import "SPSBDiscountCouponTableViewController.h" #import #import #import @interface SPSBDisplayDiscountCouponViewController () { JXHFixHeaderViewController *_contentVC; NSArray *_tableViews; } @end @implementation SPSBDisplayDiscountCouponViewController - (void)viewDidLoad { [super viewDidLoad]; [self setupUI]; [_contentVC.jxh_bgScrollView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer]; } #pragma mark - Action #pragma mark - Network Action #pragma mark - UI - (void)setupUI { self.title = @"优惠券"; [self createContentView]; [self addClassifyView]; [self createLists]; } - (void)createLists { NSMutableArray *arr = NSMutableArray.new; for (NSInteger i = 0; i < 2; i ++) { SPSBDiscountCouponTableViewController *list = SPSBDiscountCouponTableViewController.new; list.spsb_viewType = SPSBDiscountCouponViewTypeDisplay; list.spsb_canUse = i == 0; [arr addObject:list]; } _tableViews = arr; [_contentVC setListViews:_tableViews]; } - (void)addClassifyView { JXHClassifyViewConfiguration *configuration = ({ JXHClassifyViewConfiguration *configuration = JXHClassifyViewConfiguration.new; configuration.jxh_titleArray = @[@"未使用", @"已失效"]; configuration.jxh_height = 50; configuration.jxh_font = spsb_font(16); configuration.jxh_normalColor = spsb_666666_color(); configuration.jxh_selectedColor = spsb_3296FB_color(); configuration.jxh_margen = 0.f; configuration.jxh_interval = 0.f; configuration.jxh_selectedViewSize = (CGSize){60, 2.5}; configuration.jxh_selectedViewColor = spsb_3296FB_color(); configuration.jxh_equalWidth = jxh_screenWidth() / 2; configuration.jxh_isNeedSelectedView = true; configuration; }); [_contentVC setExteriorClassifyViewWithConfiguration:configuration]; [self.view addSubview:_contentVC.jxh_classifyView]; [_contentVC.jxh_classifyView makeConstraints:^(JXHConstraintMaker *make) { make.top.equalTo(self.view.safetop); make.leading.and.trailing.equalTo(0); make.height.equalTo(configuration.jxh_height); }]; } - (void)createContentView { _contentVC = JXHFixHeaderViewController.new; [self addChildViewController:_contentVC]; [self.view addSubview:_contentVC.view]; [_contentVC.view makeConstraints:^(JXHConstraintMaker *make) { make.top.equalTo(self.view.safetop).offset(50); make.leading.and.trailing.and.bottom.equalTo(0);; }]; JXHFixHeaderViewHeaderController *header = JXHFixHeaderViewHeaderController.new; [_contentVC setHeader:header]; } @end