LBNavigationController.m
1.47 KB
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
//
// LBNavigationController.m
// XianYu
//
// Created by li bo on 16/5/28.
// Copyright © 2016年 li bo. All rights reserved.
//
#import "LBNavigationController.h"
#import "LBTabBarController.h"
#import "UIImage+Image.h"
//黄色导航栏
#define NavBarColor [UIColor colorWithRed:250/255.0 green:227/255.0 blue:111/255.0 alpha:1.0]
@interface LBNavigationController ()
@end
@implementation LBNavigationController
+ (void)load
{
UIBarButtonItem *item=[UIBarButtonItem appearanceWhenContainedIn:self, nil ];
NSMutableDictionary *dic=[NSMutableDictionary dictionary];
dic[NSFontAttributeName]=[UIFont systemFontOfSize:15];
dic[NSForegroundColorAttributeName]=[UIColor blackColor];
[item setTitleTextAttributes:dic forState:UIControlStateNormal];
UINavigationBar *bar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[self]];
[bar setBackgroundImage:[UIImage imageWithColor:NavBarColor] forBarMetrics:UIBarMetricsDefault];
NSMutableDictionary *dicBar=[NSMutableDictionary dictionary];
dicBar[NSFontAttributeName]=[UIFont systemFontOfSize:15];
[bar setTitleTextAttributes:dic];
}
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
}
return [super pushViewController:viewController animated:animated];
}
@end