导航栏标题颜色设置

相当出自己刚做开发的时候朋到这个问题时候的解决方案是,

创建一个lable,让导航栏的titleView = lable

改变label的字体颜色,才实现的效果

后来才发现 原来也是有API的,希望能给朋友们带来帮助

self.navigationItem.title

=
@"hello";

NSDictionary

* dic = [NSDictionary

dictionaryWithObject:[UIColor

orangeColor]

forKey:NSForegroundColorAttributeName];

self.navigationController.navigationBar.titleTextAttributes

= dic;

[self.navigationController.navigationBar

setTitleTextAttributes:[NSDictionary

dictionaryWithObjectsAndKeys:[UIColor

redColor],

UITextAttributeTextColor,

nil]];

时间: 2024-08-01 20:16:08

导航栏标题颜色设置的相关文章

设置导航栏标题颜色及字体大小

//改变导航栏标题颜色及字体大小 e.g设置字体颜色为red 字体大小为18 self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor redColor], NSFontAttributeName : [UIFont boldSystemFontOfSize:18]}; //改变导航栏返回按钮颜色 [self.navigationControll

ios开发之自己定义默认生成的导航栏 标题 颜色 返回button

一 改动导航栏颜色    导航栏在哪个页面代码放在那里面 self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:(21.0/255.0) green:(153.0 / 255.0) blue:(224.0 / 255.0) alpha:1];                                                   //定义导航栏颜色 self.navigationItem.t

ios开发之自定义默认生成的导航栏 标题 颜色 返回按钮

一 修改导航栏颜色    导航栏在哪个页面代码放在那里面 self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:(21.0/255.0) green:(153.0 / 255.0) blue:(224.0 / 255.0) alpha:1];                                                   //定义导航栏颜色 self.navigationItem.t

【转】iOS中设置导航栏标题的字体颜色和大小

原文网址:http://www.360doc.com/content/15/0417/11/20919452_463847404.shtml iOS中设置导航栏标题的字体颜色和大小,有需要的朋友可以参考下. 在平时开发项目的时候,难免会遇到修改导航栏字体大小和颜色的需求,一般使用自定义视图的方法,其实还存在一种方法. 方法一:(自定义视图的方法,一般人也会采用这样的方式) 就是在导航向上添加一个titleView,可以使用一个label,再设置label的背景颜色透明,字体什么的设置就很简单了.

设置导航栏标题的文字属性

效果: 源码: UINavigationController+TitleTextAttributes.h 与 UINavigationController+TitleTextAttributes.m // // UINavigationController+TitleTextAttributes.h // NC // // Copyright (c) 2014年 Y.X. All rights reserved. // #import <UIKit/UIKit.h> @class NCTitl

iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)

                  #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface Ap

iOS 设置导航栏的颜色和导航栏上文字的颜色

#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface AppDelegate () @end

自定义导航栏标题按钮

自定义标题栏按钮 @implementation SNTitleButton - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { //图片居中 self.imageView.contentMode = UIViewContentModeCenter; //字体居右 self.titleLabel.textAlignment = NSTextAlignmentRight; //字体

网站点击导航栏标题,对应的元素平滑上移以及点击图片或按钮回到页面顶部的特效

之前看w3cshool上面,看到了a,name配合可以设置锚点,很多看书的网站上都用到,可以根据点击对应的目录章节,自动跳到具体的文字内容. 不过用锚点做的特效感觉很粗糙,不够平滑,总是一下子就跳到下面去了,没有给浏览者一种平滑的感觉.所以自己就计划着能不能做一种类似的比较平滑的效果呢? 当然是可以的.这篇博客中的特效要用到如下的函数和属性,大家没见过或者见过用过已经忘了的,可以到w3cshool上恶补下: eq(index):相当于数组吧,可以根据index索引到具体的对象 scrollTo(