- (void)viewDidLoad {
[self setNavgation]; //需要在
}
-(void) setNavgation{
self.navigationItem.hidesBackButton = YES;//可以隐藏原有的导航栏返回按钮
//设置的按钮会显示在导航栏左边,返回按钮的位置
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"activity_back.png"] style:UIBarButtonItemStylePlain target:self action:@selector(backViewcontroller)];
self.navigationItem.leftBarButtonItem = barButtonItem;
UINavigationBar *bar = [UINavigationBar appearance];
//设置显示的颜色
bar.barTintColor = [UIColor clearColor];
//设置字体颜色
bar.tintColor = [UIColor whiteColor];
[bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
}
修改navigationBar
最新推荐文章于 2020-10-30 16:46:46 发布
本文介绍如何在iOS应用中自定义UINavigationController的导航栏样式,包括隐藏默认返回按钮、设置自定义返回按钮图像、调整导航栏背景颜色及字体颜色。
1588

被折叠的 条评论
为什么被折叠?



