// // DRCommunityViewController.m // YouHuiProject // // Created by 小花 on 2018/5/16. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRCommunityViewController.h" #import "DRCommunityLeftController.h" #import "DRCommunityRightController.h" #import "MLMSegmentHead.h" #import "MLMSegmentManager.h" @interface DRCommunityViewController () { NSInteger _page; } @property (nonatomic, strong) MLMSegmentHead *titleView; @property (nonatomic, strong) MLMSegmentScroll *segScroll; @end @implementation DRCommunityViewController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self creatSwitchView]; [self addReloadObser]; } - (void)addReloadObser { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshData) name:ChangeSex object:nil]; } - (void)refreshData { [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]; [SVProgressHUD dismiss]; } -(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 backgroudColor]; NSMutableArray *list = [NSMutableArray array]; // DRCommunityRightController *seg1 = [[DRCommunityRightController alloc] init]; // [list addObject:seg1]; DRCommunityLeftController *seg2 = [[DRCommunityLeftController alloc] init]; [list addObject:seg2]; self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, ChildTableViewHeight+40) vcOrViews:list]; self.segScroll.loadAll = YES; [MLMSegmentManager associateHead:nil withScroll:self.segScroll completion:^{ [self.view addSubview:self.segScroll]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end