修改导航栏字体颜色及背景色

2016-01-21  本文已影响3019人  koreadragon

http://www.hangge.com/blog/cache/detail_957.html

修改返回按钮




//修改导航条背景色(红褐色)
self.navigationController.navigationBar.barTintColor = RGB(175, 24, 50, 1.0);
其中RGB为我的工程里的一个宏定义:
#define RGB(r,g,b,a)   [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:(a)]

//修改导航条标题颜色(白色)
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
    
//修改导航条添加的按钮(item)颜色(黄色)
self.navigationController.navigationBar.tintColor = [UIColor yellowColor];




需要注意一点: 这个设置完成之后,从他push过去的页面颜色都是这种效果。


导航条颜色

---设置tabbar图片####

/**
     消息
     */
    Message *message =[[Message alloc]init];
    UIImage *mImage = [UIImage imageNamed:@"oneUnSelect"];
    UIImage *selectmImage = [UIImage imageNamed:@"oneSelect"];
    mImage = [mImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    selectmImage = [selectmImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    message.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"消息" image:mImage selectedImage:selectmImage];
    NavigationController *messageNa = [[NavigationController alloc]initWithRootViewController:message];
上一篇下一篇

猜你喜欢

热点阅读