一 navigationbar颜色
不设置为NO会产生色差,但是设置后view会产生偏移,下移64
self.navigationController.navigationBar.translucent = NO;// Bar的模糊效果,默认为YES
self.navigationController.navigationBar.barTintColor =[UIColor colorWithRed:36/255.0 green:41/255.0 blue:55/255.0 alpha:1];二 navigationbar字体颜色
1,
<span style="font-size:10px;">NSDictionary *attributes=[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil];
[self.navigationController.navigationBar setTitleTextAttributes:attributes];</span>
<span style="font-size:10px;">UILabel *lb =[[UILabel alloc]initWithFrame:CGRectMake(10, 4, 60, 40)];
lb.text =@"哈哈哈哈";
self.navigationItem.titleView =lb;</span>这个是全局设置
//设置NavigationBar背景颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
//@{}代表Dictionary
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
本文详细介绍了如何调整iOS导航栏的颜色和字体,包括如何禁用模糊效果、设置背景颜色、修改字体颜色等操作,提供了全局设置和局部设置两种方式。

1415

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



