iOS 修改导航条样式

//导航条样式
#import "UINavigationBar+Awesome.h"

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
    //清空 导航栏背景颜色
    [self.navigationController.navigationBar lt_reset];
    //清空 返回按钮颜色
    self.navigationController.navigationBar.tintColor =  nil;
    //清空 标题颜色
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor],NSFontAttributeName: [UIFont systemFontOfSize:16]}];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    
    self.view.backgroundColor = RGBACOLOR(66, 170, 250, 1.0);
    
    //导航栏背景颜色
    [self.navigationController.navigationBar lt_setBackgroundColor:[UIColor clearColor]];
    
    // 去掉导航条下边的线
    self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];

    //返回按钮颜色
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    //标题颜色
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],NSFontAttributeName: [UIFont systemFontOfSize:16]}];
}

参考:https://github.com/ltebean/LTNavigationBar

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容