iOS6 导航条title字体和颜色-不适用自定义视图

一般的我们都是通过自定义视图来设置导航条的title颜色和字体的
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
    titleLabel.text = @"详情";
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = titleLabel;
但是iOS6之后有了新的方法可以直解设置title的字体和颜色
[self.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, [UIFont systemFontOfSize:20], NSFontAttributeName, nil]];

时间: 2024-08-03 18:38:08

iOS6 导航条title字体和颜色-不适用自定义视图的相关文章

iOS-修改导航栏文字字体和颜色

//修改导航栏文字字体和颜色 nav.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[RGBColor colorWithHexString:@"#4b95f2"],NSFontAttributeName:[UIFont boldSystemFontOfSize:20]}; //修改导航栏颜色 [[UINavigationBar appearance]setBarTintColor:[RGBCo

iOS viewController添加导航条以及返回跳转选择

给单独的viewcontroller或者在Appdelegate的主页面添加导航条,只要在viewcontroller上添加navigationcontroller,在添加此navigationcontroller即可 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow allo

导航条颜色

//导航条背景颜色 self.navigationController.navigationBar.barTintColor = [UIColor blueColor]; //导航条上面控件颜色 self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; //设置系统导航条的title字体大小和颜色 [self.navigationController.navigationBar setTitleTextAt

自定义导航条上的标题文字的大小以及颜色

在做项目开发时,有的时候回自定义导航条视图,常见的是设置标题文字的大小颜色.左侧以及右侧navgationItem. 在做自定义导航视图的时候 ,导航项都可以用自定义视图的形式自定义. 自定义导航条标题的时候有两种方法:一是,采用自定义视图的方式:二是,采用系统的方法. 采用自定义视图view的方式 就是在导航向上添加一个titleView,可以使用一个label,再设置label的背景颜色透明,字体什么的设置就很简单了. UILabel *titleLabel = [[UILabel allo

导航栏上字体与图标的颜色设置

//导航栏上背景色  self.navigationController.navigationBar.barTintColor = RGB(117, 178, 240); //导航栏上自己添加的控件的颜色     self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; //导航栏上字体的颜色     self.navigationController.navigationBar.titleTextAttr

iOS 导航条的基本用法

//导航条标题 self.navigationItem.title = @"title"; //导航条返回时文字的设置 self.navigationController.navigationBar.topItem.title= @""; //导航条返回时箭头颜色的设置 self.navigationController.navigationBar.tintColor = [UIColor redColor]; //导航条的颜色 self.navigationCon

神奇的Bootstrap 导航条 全面实战篇

转载请注明出处:http://blog.csdn.net/smartbetter/article/details/52056377 导航条(navbar)在Bootstrap中是一个独立组件,导航条(navbar)和导航(nav)在Bootstrap中是有明显的区别的.在导航条(navbar)中有一个背景色.而且导航条可以是纯链接.表单.表单和导航一起结合等多种形式. 1.实战一-带二级菜单和表单的导航条 <!DOCTYPE HTML> <html> <head> &l

【CSS】 一个简单的导航条

今天来做一个导航条! 首先写一个坯子: 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;cha

多种类型的导航条制作【css3,jquery】

导航条的使用很广,每个网站都会做出具有自己特色的导航条.最近特地去了解了各种类型的导航条,比如具有高亮显示的导航条,中英文互相切换的导航条,具有弹性动画的导航条,甚至是具有摩擦运动动画的导航条(文字下面有横线)等.每种导航条都有自己的特色,比如高亮显示的导航条看起来比较简单,但是视觉效果还不错,具有动画效果的导航条在视觉上也是有很好的效果. 接下来将会一一介绍4种应用比较广的导航条,即:高亮显示的导航条,中英文互相切换的导航条,具有弹性动画的导航条,具有摩擦运动动画的导航条. 1.高亮显示的导航