-
Notifications
You must be signed in to change notification settings - Fork 1
/
ELMainTabBarViewController.m
70 lines (52 loc) · 2.01 KB
/
ELMainTabBarViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// ELMainTabBarViewController.m
// MovieMood
//
// Created by Eric Lee on 9/20/14.
// Copyright (c) 2014 Eric Lee Productions. All rights reserved.
//
#import "ELMainTabBarViewController.h"
#import "ELMainTabProtocol.h"
#import "ELMainTabAnimator.h"
@interface ELMainTabBarViewController ()
@end
@implementation ELMainTabBarViewController
-(void) awakeFromNib {
[super awakeFromNib];
self.delegate = self;
}
- (void)viewDidLoad {
[super viewDidLoad];
}
-(void) viewWillAppear:(BOOL)animated {
UIViewController<ELMainTabProtocol> *controller = (UIViewController<ELMainTabProtocol> *) self.selectedViewController;
[self hideNavBarWithVC: controller];
[super viewWillAppear: animated];
[self hideNavBarWithVC: (UIViewController<ELMainTabProtocol>*) self.selectedViewController];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - UITabViewControllerDelegate
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
UIViewController<ELMainTabProtocol> *controller = (UIViewController<ELMainTabProtocol>* )viewController;
[self hideNavBarWithVC: controller];
}
-(id<UIViewControllerAnimatedTransitioning>) tabBarController:(UITabBarController *)tabBarController animationControllerForTransitionFromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC {
ELMainTabAnimator *animator = [[ELMainTabAnimator alloc] init];
return animator;
}
#pragma mark - Helper Functions
-(void) hideNavBarWithVC: (UIViewController<ELMainTabProtocol>*) controller {
/*if([controller shouldShowNavBar]) {
self.navigationController.navigationBar.alpha = 1;
}
else {
self.navigationController.navigationBar.alpha = 0;
}*/
[self.navigationController setNavigationBarHidden: ![controller shouldShowNavBar] animated: YES];
[self setTitle: controller.title];
}
@end