导航栏,自定义

1标题颜色:

(在默认显示的标题中直接修改文件的大小和颜色也是可以的)

 

[self.navigationController.navigationBar setTitleTextAttributes:

@{NSFontAttributeName:[UIFont systemFontOfSize:19],

NSForegroundColorAttributeName:[UIColor redColor]}];

2,

((UILabel *)self.navigationItem.titleView).textColor = [UIColor whiteColor];

 

3,

 

这是导航栏的问题,将下边的代码放在  viewWillAppear  方法中就可以实现效果:

 

 

- (void)viewWillAppear:(BOOL)animated{

    

    // Called when the view is about to made visible. Default does nothing    

    [super viewWillAppear:animated];

  

    //去除导航栏下方的横线

    [navigationBar setBackgroundImage:[UIImage imageWithColor:[self colorFromHexRGB:@"33cccc"]]

                       forBarPosition:UIBarPositionAny

                           barMetrics:UIBarMetricsDefault];

    [navigationBar setShadowImage:[UIImage new]];

    

}

2,

 self.navigationController.navigationBar.translucent = NO;//关闭透明度

//去除分界线

    [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];

    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc]init]];

 3,设置导航栏背景

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"1.png"] forBarMetrics:UIBarMetricsCompact];图片随便设置

转载于:https://www.cnblogs.com/conan0919/p/5009873.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值