BGShopViewController.m 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. //
  2. // BGShopViewController.m
  3. // BuguLive
  4. //
  5. // Created by 志刚杨 on 2019/4/1.
  6. // Copyright © 2019 xfg. All rights reserved.
  7. //
  8. #import "BGShopViewController.h"
  9. #import "BGMainWebViewController.h"
  10. @interface BGShopViewController ()<MLMSegmentHeadDelegate>
  11. @property(nonatomic, strong) NSArray *list;
  12. @property(nonatomic, strong) BGMainWebViewController *tmpController;
  13. @property(nonatomic, strong) BGMainWebViewController *tmpController2;
  14. @property(nonatomic, strong) BGMainWebViewController *tmpController3;
  15. @end
  16. @implementation BGShopViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. [self segmentStyle1];
  20. // Do any additional setup after loading the view.
  21. // 返回按钮
  22. [self setupBackBtnWithBlock:nil];
  23. self.view.backgroundColor = kWhiteColor;
  24. }
  25. - (void)viewWillLayoutSubviews
  26. {
  27. [super viewWillLayoutSubviews];
  28. self.navigationController.navigationBar.hidden = NO;
  29. }
  30. - (void)segmentStyle1 {
  31. _list = @[ASLocalizedString(@" VIP会员 "),
  32. ASLocalizedString(@" 座驾商城 "),
  33. ASLocalizedString(@" 靓号 ")];
  34. _segHead = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(0, 0, kScreenW , 60) titles:_list headStyle:SegmentHeadStyleLine layoutStyle:MLMSegmentLayoutCenter];
  35. //tab颜色
  36. _segHead.selectColor = kWhiteColor;
  37. _segHead.delegate = self;
  38. // kGrayColor;
  39. // Main_textColor;
  40. _segHead.lineColor = Main_textColor;
  41. _segHead.fontScale = 1;
  42. _segHead.lineHeight = 2.3;
  43. _segHead.fontSize = 14;
  44. _segHead.slideHeight = 28;
  45. _segHead.lineScale = .5;
  46. _segHead.headColor = kClearColor;
  47. _segHead.bottomLineHeight = 0;
  48. _segHead.deSelectColor = [UIColor colorWithHexString:@"#666666"];
  49. // Main_textColor;
  50. _segHead.centerX = kScreenW / 2;
  51. self.view.backgroundColor = kClearColor;
  52. _segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_segHead.frame), SCREEN_WIDTH, SCREEN_HEIGHT-CGRectGetMaxY(_segHead.frame) - kNavigationBarHeight - 40) vcOrViews:[self vcArr:_list.count]];
  53. _segScroll.loadAll = NO;
  54. _segScroll.showIndex = 1;
  55. [MLMSegmentManager associateHead:_segHead withScroll:_segScroll completion:^{
  56. [self.view addSubview:_segHead];
  57. [self.view addSubview:_segScroll];
  58. }];
  59. }
  60. -(void)changeBtnFrom:(UIButton *)btn{
  61. [btn setBackgroundImage:[UIImage imageNamed:@"mg_new_list_concert"] forState:UIControlStateNormal];
  62. }
  63. - (void)viewWillAppear:(BOOL)animated {
  64. [super viewWillAppear:animated];
  65. if(_tmpController.webView.URL == nil)
  66. {
  67. _tmpController =[BGMainWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.h5_url.members_url isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  68. [_tmpController reLoadCurrentWKWebView];
  69. // _vc3 =
  70. // [FWMainWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.h5_url.pay_car isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  71. }
  72. if(_tmpController2.webView.URL == nil)
  73. {
  74. _tmpController2 =[BGMainWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.h5_url.pay_car isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  75. [_tmpController2 reLoadCurrentWKWebView];
  76. _tmpController2.webView.height = kScreenH - kNavigationBarHeight - _segHead.height - 40;
  77. // _vc3 =
  78. // [FWMainWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.h5_url.pay_car isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  79. }
  80. if(_tmpController3.webView.URL == nil)
  81. {
  82. _tmpController3 =[BGMainWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.h5_url.luck_num_url isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  83. [_tmpController3 reLoadCurrentWKWebView];
  84. // _vc3 =
  85. // [FWMainWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.h5_url.pay_car isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  86. }
  87. }
  88. #pragma mark - 数据源
  89. - (NSArray *)vcArr:(NSInteger)count {
  90. NSMutableArray *arr = [NSMutableArray array];
  91. NSString *tmpUrlStr = [GlobalVariables sharedInstance].appModel.h5_url.members_url;
  92. _tmpController =[BGMainWebViewController webControlerWithUrlStr:tmpUrlStr isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  93. _tmpController.navTitleStr = ASLocalizedString(@"VIP会员");
  94. _tmpController.isShowSegHead = YES;
  95. [arr addObject:_tmpController];
  96. NSString *tmpUrlStr2 = [GlobalVariables sharedInstance].appModel.h5_url.pay_car;
  97. _tmpController2 =[BGMainWebViewController webControlerWithUrlStr:tmpUrlStr2 isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  98. _tmpController2.navTitleStr = ASLocalizedString(@"座驾");
  99. _tmpController2.isShowSegHead = YES;
  100. [arr addObject:_tmpController2];
  101. NSString *tmpUrlStr3 = [GlobalVariables sharedInstance].appModel.h5_url.luck_num_url;
  102. _tmpController3 =[BGMainWebViewController webControlerWithUrlStr:tmpUrlStr3 isShowIndicator:NO isShowNavBar:YES isShowTabBar:YES];
  103. _tmpController3.navTitleStr = ASLocalizedString(@"靓号");
  104. _tmpController3.isShowSegHead = YES;
  105. [arr addObject:_tmpController3];
  106. return arr;
  107. }
  108. /*
  109. #pragma mark - Navigation
  110. // In a storyboard-based application, you will often want to do a little preparation before navigation
  111. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  112. // Get the new view controller using [segue destinationViewController].
  113. // Pass the selected object to the new view controller.
  114. }
  115. */
  116. @end