iOS导航栏修改背景色

2017-08-31  本文已影响0人  OrrHsiao

按此方法修改背景色

- (void)viewWillAppear:(BOOL)animated

{

[superviewWillAppear:animated];

[self.navigationControllersetNavigationBarHidden:NO];

}

//修改背景颜色

[[UINavigationBarappearance]setBackgroundColor:LIGHTGBLUECOLOR];

[[UINavigationBarappearance]setBarTintColor:LIGHTGBLUECOLOR];

//修改返回按钮字体颜色

self.navigationController.navigationBar.tintColor= [UIColorwhiteColor];

//修改返回按钮文字

self.navigationItem.backBarButtonItem= [[UIBarButtonItemalloc]initWithTitle:@"返回"style:UIBarButtonItemStylePlaintarget:nilaction:nil];

//修改导航栏标题颜色

self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColorwhiteColor],NSFontAttributeName:[UIFontboldSystemFontOfSize:17]};

self.view.backgroundColor=LIGHTGGRAYCOLOR_BG;

self.navigationController.navigationBar.translucent=NO;

}

参考文章:iOS NavigationBar 导航栏背景颜色设置方案探究

上一篇下一篇

猜你喜欢

热点阅读