设置返回按钮
UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:0 target:nil action:nil];
[self.navigationItem setBackBarButtonItem:bar];
设置navititle颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
显示隐藏tabbar
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.tabBarController.tabBar.hidden = NO;
}
非半透明,且隐藏黑线
[[UINavigationBar appearance] setTranslucent:NO];
self.navigationController.navigationBar.subviews[0].subviews[0].hidden = YES;
添加右侧按钮
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"提交" style:UIBarButtonItemStylePlain target:self action:@selector(feedbackAction)];
self.navigationItem.rightBarButtonItem = anotherButton;
navigationbar字体颜色
self.navigationController.navigationBar.backgroundColor = kZKP_COLOR_NAV_BAR;
self.navigationController.navigationBar.barTintColor = kZKP_COLOR_NAV_BAR;
statusbar字体颜色
- (void)setStatusBarBackgroundColor:(UIColor *)color {
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
statusBar.backgroundColor = color;
}
}