// // ZBLiveDataVC.m // ZBProject // // Created by 学丽 on 2019/4/9. // Copyright © 2019 ZB. All rights reserved. // #import "ZBLiveDataVC.h" #import "ZBOrderListVC.h" #import "ZBSaleTrendVC.h" @interface ZBLiveDataVC () @end @implementation ZBLiveDataVC - (void)viewDidLoad { [super viewDidLoad]; [self initNav]; } -(void)initNav { // self.tabBarController.tabBar.hidden=YES; self.navBar.navTitleLabel.text=@"今日直播数据"; self.navigationController.navigationBar.hidden=NO; UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 30, 20)]; [returnBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside]; [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal]; returnBtn.adjustsImageWhenHighlighted = NO; [self.navBar setCustomLeftButtons:@[returnBtn]]; self.titlesArr=@[@"实时订单",@"热销商品",@"销量走势"]; [self updateSuperTitleAry]; } - (void)addChildViewController{ for (int i = 0; i < self.titlesArr.count; i++) { if (i == 0) { ZBOrderListVC * vc = [[ZBOrderListVC alloc] init]; vc.title = self.titlesArr[i]; [self addChildViewController:vc]; }else if(i == 1){ ZBHotGoodVC* vc = [[ZBHotGoodVC alloc] init]; vc.title = self.titlesArr[i]; [self addChildViewController:vc]; }else{ ZBSaleTrendVC * vc = [[ZBSaleTrendVC alloc] init]; vc.title = self.titlesArr[i]; [self addChildViewController:vc]; } } } -(void)setUpCurrentChildController:(NSInteger)index { NSLog(@"%ld",index); if (index == 0) { [[NSNotificationCenter defaultCenter]postNotificationName:@"listorder" object:nil]; }else if (index == 1) { [[NSNotificationCenter defaultCenter]postNotificationName:@"hotorder" object:nil]; } } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear: animated]; } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; self.tabBarController.tabBar.hidden=NO; } -(void)returnClickBtn { [self.navigationController popViewControllerAnimated:YES]; } #pragma mark -- 移除通知 -(void)dealloc{ [[NSNotificationCenter defaultCenter]removeObserver:self]; } @end