// // KBCommunityViewController.m // YouHuiProject // // Created by 小花 on 2018/5/16. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBCommunityViewController.h" #import "KBCommunityLeftController.h" #import "KBCommunityRightController.h" #import "MLMSegmentHead.h" #import "MLMSegmentManager.h" @interface KBCommunityViewController () { NSInteger _page; } @property (nonatomic, strong) MLMSegmentHead *titleView; @property (nonatomic, strong) MLMSegmentScroll *segScroll; @end @implementation KBCommunityViewController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self creatSwitchView]; } - (void)configNavigationBar{ [self.navigationBar setNavTitle:@"口袋优选"]; self.view.backgroundColor = [UIColor whiteColor]; self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor]; self.navigationBar.backgroundColor = [UIColor changeColor]; } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; } -(void)viewDidDisappear:(BOOL)animated{ [super viewDidDisappear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; } -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; } - (void)creatSwitchView { self.view.backgroundColor = [UIColor whiteColor]; NSArray *titleArr = @[@"优选商品",@"优选素材"]; NSMutableArray *list = [NSMutableArray array]; KBCommunityLeftController *seg = [[KBCommunityLeftController alloc] init]; [list addObject:seg]; KBCommunityRightController *seg2 = [[KBCommunityRightController alloc] init]; [list addObject:seg2]; self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight+40, SCREEN_WIDTH, ChildTableViewHeight) vcOrViews:list]; self.segScroll.loadAll = YES; self.titleView = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 40) titles:titleArr headStyle:SegmentHeadStyleDefault layoutStyle:MLMSegmentLayoutDefault]; self.titleView.headColor = [UIColor clearColor]; self.titleView.bottomLineHeight = 1; self.titleView.bottomLineColor = [UIColor yhGrayColor]; self.titleView.fontScale = 1; self.titleView.fontSize = 14; self.titleView.equalSize = YES; self.titleView.bottomLineHeight = 0; self.titleView.showIndex = 0; self.titleView.selectColor = [UIColor YHColorWithHex:0xff442a]; self.titleView.deSelectColor = [UIColor YHColorWithHex:0x666666]; [MLMSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{ [self.view addSubview:self.titleView]; [self.view addSubview:self.segScroll]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end