作品鏈接:
http://www.reibang.com/users/1e0f5e6f73f6/top_articles
1.通過setTintColor設(shè)置導(dǎo)航條文字的顏色
[bar setTintColor:[UIColor whiteColor]];
2.通過圖片設(shè)置琳省,在Images.xcassets里設(shè)置圖片為非default
- 代碼
// self -> 導(dǎo)航控制器
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count != 0) { // 非跟控制器 隱藏底部導(dǎo)航條
viewController.hidesBottomBarWhenPushed = YES;
// 設(shè)置導(dǎo)航條左邊按鈕的內(nèi)容,把系統(tǒng)的返回按鈕給覆蓋,導(dǎo)航控制器的滑動(dòng)返回功能就木有啦
viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"導(dǎo)航欄按鈕的圖片"] style:UIBarButtonItemStyleBordered target:self action:@selector(back)];
}
// 返回
[super pushViewController:viewController animated:animated];
}
- (void)back
{
[self popViewControllerAnimated:YES];
}