您的位置:首页 > 其它

navigationbar颜色和字体颜色的设置

2015-12-29 15:01 176 查看
一 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>


2,

<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]}];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: