ios自定义UINavigationController

 1 #import <UIKit/UIKit.h>
 2 
 3 @interface NJNavigationController : UINavigationController
 4 
 5 @end
 6 
 7 
 8 
 9 #import "NJNavigationController.h"
10 
11 @interface NJNavigationController ()
12 
13 @end
14 
15 @implementation NJNavigationController
16 
17 
18 
19 // 当该类第一次用到的时候就调用
20 + (void)initialize
21 {
22 //    NSLog(@"initialize");
23     // 3.设置导航条的主题
24     // 如果要同时设置很多UINavigationBar的样式, 可以通过设置UINavigationBar的主题的方式来设置以便简化代码
25     UINavigationBar *navBar = [UINavigationBar appearance];
26     // 3.1设置所有导航条的背景图片
27     // 判断当前运行的操作系统的版本
28         [navBar setBackgroundImage:[UIImage imageNamed:@"NavBar64"] forBarMetrics:UIBarMetricsDefault];
29     
30     // 3.2设置所有导航条的标题颜色
31     NSMutableDictionary *md = [NSMutableDictionary dictionary];
32     md[NSFontAttributeName] = [UIFont systemFontOfSize:16];
33     md[NSForegroundColorAttributeName] = [UIColor whiteColor];
34     [navBar setTitleTextAttributes:md];
35 
36 }
37 
38 - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
39 {
40 //    NSLog(@"pushViewController");
41     
42     // 拿到目标控制器(即将要入栈的控制器), 设置它的自动隐藏tabbar
43     viewController.hidesBottomBarWhenPushed = YES;
44     [super pushViewController:viewController animated:animated];
45     
46 }
47 
48 //- (UIViewController *)popViewControllerAnimated:(BOOL)animated
49 //{
50 //     return [super popViewControllerAnimated:NO];
51 //}
52 @end

 

转载于:https://www.cnblogs.com/PJHome/p/5155574.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值