dkahgld

ZBLiveDataVC.m 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // ZBLiveDataVC.m
  3. // ZBProject
  4. //
  5. // Created by 学丽 on 2019/4/9.
  6. // Copyright © 2019 ZB. All rights reserved.
  7. //
  8. #import "ZBLiveDataVC.h"
  9. #import "ZBOrderListVC.h"
  10. #import "ZBSaleTrendVC.h"
  11. @interface ZBLiveDataVC ()
  12. @end
  13. @implementation ZBLiveDataVC
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. [self initNav];
  17. }
  18. -(void)initNav
  19. {
  20. // self.tabBarController.tabBar.hidden=YES;
  21. self.navBar.navTitleLabel.text=@"今日直播数据";
  22. self.navigationController.navigationBar.hidden=NO;
  23. UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 30, 20)];
  24. [returnBtn addTarget:self action:@selector(returnClickBtn) forControlEvents:UIControlEventTouchUpInside];
  25. [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal];
  26. returnBtn.adjustsImageWhenHighlighted = NO;
  27. [self.navBar setCustomLeftButtons:@[returnBtn]];
  28. self.titlesArr=@[@"实时订单",@"热销商品",@"销量走势"];
  29. [self updateSuperTitleAry];
  30. }
  31. - (void)addChildViewController{
  32. for (int i = 0; i < self.titlesArr.count; i++) {
  33. if (i == 0) {
  34. ZBOrderListVC * vc = [[ZBOrderListVC alloc] init];
  35. vc.title = self.titlesArr[i];
  36. [self addChildViewController:vc];
  37. }else if(i == 1){
  38. ZBHotGoodVC* vc = [[ZBHotGoodVC alloc] init];
  39. vc.title = self.titlesArr[i];
  40. [self addChildViewController:vc];
  41. }else{
  42. ZBSaleTrendVC * vc = [[ZBSaleTrendVC alloc] init];
  43. vc.title = self.titlesArr[i];
  44. [self addChildViewController:vc];
  45. }
  46. }
  47. }
  48. -(void)setUpCurrentChildController:(NSInteger)index
  49. {
  50. NSLog(@"%ld",index);
  51. if (index == 0) {
  52. [[NSNotificationCenter defaultCenter]postNotificationName:@"listorder" object:nil];
  53. }else if (index == 1)
  54. {
  55. [[NSNotificationCenter defaultCenter]postNotificationName:@"hotorder" object:nil];
  56. }
  57. }
  58. -(void)viewWillAppear:(BOOL)animated
  59. {
  60. [super viewWillAppear: animated];
  61. }
  62. -(void)viewWillDisappear:(BOOL)animated
  63. {
  64. [super viewWillDisappear:animated];
  65. self.tabBarController.tabBar.hidden=NO;
  66. }
  67. -(void)returnClickBtn
  68. {
  69. [self.navigationController popViewControllerAnimated:YES];
  70. }
  71. #pragma mark -- 移除通知
  72. -(void)dealloc{
  73. [[NSNotificationCenter defaultCenter]removeObserver:self];
  74. }
  75. @end