1.新建导航控制器类
2.自定义导航视图部分样式
self.navigationBar.translucent = NO;
self.navigationBar.barTintColor = [UIColor whiteColor];
self.navigationBar.tintColor = UIColorHex(0x333333);
NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary];
selectedAttrs[NSFontAttributeName] = UIFontOfMedium(17);
selectedAttrs[NSForegroundColorAttributeName] = UIColorHex(0x333333);
[self.navigationBar setTitleTextAttributes:selectedAttrs];
//设置导航栏Item字体
UIBarButtonItem *barButtonItem = [UIBarButtonItem appearance];
[barButtonItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:UIFontOfSemibold(15), NSFontAttributeName, nil] forState:UIControlStateNormal];
[barButtonItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:UIFontOfSemibold(15), NSFontAttributeName, nil] forState:UIControlStateHighlighted];
3.自定义返回按钮
//引入代理
self.interactivePopGestureRecognizer.delegate = self;
//代理方法
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_back_black"] style:(UIBarButtonItemStyleDone) target:self action:@selector(backAction)];
viewController.navigationItem.leftBarButtonItem = backItem;
}
[super pushViewController:viewController animated:animated];
}
//返回按钮事件
- (void)backAction{
[self popViewControllerAnimated:YES];
}