设置UINavigationController标题的属性
设置UINavigationController标题的属性


self.title = @"产品详情";
[self.navigationController.navigationBar setTitleTextAttributes:\
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor redColor], NSForegroundColorAttributeName,
[UIFont systemFontOfSize:.f], NSFontAttributeName,
nil]];
可以设置的属性有如下这些:
/************************ Attributes ************************/ /* Predefined character attributes for text. If the key is not in the dictionary, then use the default values as described below.
*/
UIKIT_EXTERN NSString *const NSFontAttributeName NS_AVAILABLE_IOS(6_0); // UIFont, default Helvetica(Neue) 12
UIKIT_EXTERN NSString *const NSParagraphStyleAttributeName NS_AVAILABLE_IOS(6_0); // NSParagraphStyle, default defaultParagraphStyle
UIKIT_EXTERN NSString *const NSForegroundColorAttributeName NS_AVAILABLE_IOS(6_0); // UIColor, default blackColor
UIKIT_EXTERN NSString *const NSBackgroundColorAttributeName NS_AVAILABLE_IOS(6_0); // UIColor, default nil: no background
UIKIT_EXTERN NSString *const NSLigatureAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing integer, default 1: default ligatures, 0: no ligatures
UIKIT_EXTERN NSString *const NSKernAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing floating point value, in points; amount to modify default kerning. 0 means kerning is disabled. (note: values other than nil and 0 are unsupported on iOS)
UIKIT_EXTERN NSString *const NSStrikethroughStyleAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing integer, default 0: no strikethrough
UIKIT_EXTERN NSString *const NSUnderlineStyleAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing integer, default 0: no underline
UIKIT_EXTERN NSString *const NSStrokeColorAttributeName NS_AVAILABLE_IOS(6_0); // UIColor, default nil: same as foreground color
UIKIT_EXTERN NSString *const NSStrokeWidthAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing floating point value, in percent of font point size, default 0: no stroke; positive for stroke alone, negative for stroke and fill (a typical value for outlined text would be 3.0)
UIKIT_EXTERN NSString *const NSShadowAttributeName NS_AVAILABLE_IOS(6_0); // NSShadow, default nil: no shadow
UIKIT_EXTERN NSString *const NSTextEffectAttributeName NS_AVAILABLE_IOS(7_0); // NSString, default nil: no text effect UIKIT_EXTERN NSString *const NSAttachmentAttributeName NS_AVAILABLE_IOS(7_0); // NSTextAttachment, default nil
UIKIT_EXTERN NSString *const NSLinkAttributeName NS_AVAILABLE_IOS(7_0); // NSURL (preferred) or NSString
UIKIT_EXTERN NSString *const NSBaselineOffsetAttributeName NS_AVAILABLE_IOS(7_0); // NSNumber containing floating point value, in points; offset from baseline, default 0
UIKIT_EXTERN NSString *const NSUnderlineColorAttributeName NS_AVAILABLE_IOS(7_0); // UIColor, default nil: same as foreground color
UIKIT_EXTERN NSString *const NSStrikethroughColorAttributeName NS_AVAILABLE_IOS(7_0); // UIColor, default nil: same as foreground color
UIKIT_EXTERN NSString *const NSObliquenessAttributeName NS_AVAILABLE_IOS(7_0); // NSNumber containing floating point value; skew to be applied to glyphs, default 0: no skew
UIKIT_EXTERN NSString *const NSExpansionAttributeName NS_AVAILABLE_IOS(7_0); // NSNumber containing floating point value; log of expansion factor to be applied to glyphs, default 0: no expansion UIKIT_EXTERN NSString *const NSWritingDirectionAttributeName NS_AVAILABLE_IOS(7_0); // NSArray of NSNumbers representing the nested levels of writing direction overrides as defined by Unicode LRE, RLE, LRO, and RLO characters. The control characters can be obtained by masking NSWritingDirection and NSTextWritingDirection values. LRE: NSWritingDirectionLeftToRight|NSTextWritingDirectionEmbedding, RLE: NSWritingDirectionRightToLeft|NSTextWritingDirectionEmbedding, LRO: NSWritingDirectionLeftToRight|NSTextWritingDirectionOverride, RLO: NSWritingDirectionRightToLeft|NSTextWritingDirectionOverride, UIKIT_EXTERN NSString *const NSVerticalGlyphFormAttributeName NS_AVAILABLE_IOS(6_0); // An NSNumber containing an integer value. 0 means horizontal text. 1 indicates vertical text. If not specified, it could follow higher-level vertical orientation settings. Currently on iOS, it's always horizontal. The behavior for any other value is undefined.
设置UINavigationController标题的属性的更多相关文章
- 设置UINavigationController相同标题
设置UINavigationController相同标题,让UINavigationController内的每一个ViewController的标题都一样,可以使用以下设置. UINavigation ...
- iOS - UIButton设置文字标题下划线以及下划线颜色
创建button设置可以折行显示 - (void)viewDidLoad { [super viewDidLoad]; UIButton * button = [[UIButton alloc] in ...
- Winforn中设置ZedGraph曲线图的属性、坐标轴属性、刻度属性
场景 C#窗体应用中使用ZedGraph曲线插件绘制图表: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/99716066 在上面 ...
- Format a Business Object Caption 设置业务对象标题的格式
In this lesson, you will learn how to format the caption of a detail form that displays a business o ...
- React项目动态设置title标题
在React搭建的SPA项目中页面的title是直接写在入口index.html中,当路由在切换不用页面时,title是不会动态变化的.那么怎么让title随着路由的切换动态变化呢?1.在定义路由时增 ...
- PyQt(Python+Qt)学习随笔:QTreeWidget中标题相关属性访问方法headerItem、setHeaderLabels
老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 树型部件窗口可以有一个标题头,其中包含部件中每个列的节(即标题).QTreeWidget的标题属性包 ...
- ZeroMQ接口函数之 :zmq_setsockopt –设置ZMQ socket的属性
ZeroMQ API 目录 :http://www.cnblogs.com/fengbohello/p/4230135.html 本文地址 :http://www.cnblogs.com/fengbo ...
- hibernate中保存一个对象后再设置此对象的属性为什么不需要调用update方法了
hibernate中保存一个对象后再设置此对象的属性为什么不需要调用update方法了 例如session.save(user);user.setAge(20); 原因: hibernate对象的三种 ...
- VBA在WORD中给表格外的字体设置为标题
使用VB可以将表外的字体设置标题字体实际操作如下: VB代码如下: Sub oliver_1() Selection.EndKey Unit:=wdStory '光标移到文末 To ActiveDoc ...
随机推荐
- leetcode 98,判断二叉树为BST
方法一,记录子树的上界和下界,root的左子树一定小于root的值,root的右子树一定大于root的值,然后递归左子树和右子树 public class Solution { public bool ...
- 终于完成了-- github.com/salomon1184/METP
- windows端口查看及进程查找
1. 使用netstat查看端口 netstat -ano 2. 查找特定端口号: netstat -aon|findstr "port" 3. 查找该端口的进程 tasklist ...
- 微信小程序之特殊效果及功能
一.下拉刷新效果 假设页面为index文件,那么代码如下: index.json: { "enablePullDownRefresh": true } index.js: //下拉 ...
- WinForm 多语言处理
多语言处理工具我使用的是 SailingEase .NET Resources Tool ,好处是导出一个Excel,把具体翻译工作交给专业的人来做,翻译ok后再导入,缺点就是后续更改麻烦,添加一个 ...
- c#基础学习(0708)之静态类
再静态类中,所包含的所有成员都是“静态成员” 不是所有的静态成员都必须卸载静态类中 静态成员时属于“类”的,不是属于具体“对象”的,所以访问静态成员的时候不能通过对象来访问(对象.属性名),只能通过“ ...
- Json.Net 反序列化成匿名对象
反序列化一个object var str1 = "{id:1,name:'111',x:[1,2,3],y:{a:'ssss',b:'dddd'}"; var obj1 = Jso ...
- 长期更新系列:C#知识点
PS:写这个主要是基础差,写这么一个主要是为了自己查漏补缺,不会的搞会了.会了搞的更会.顺便整理知识. 目录 1.C#知识点:值类型和引用类型 2.C#知识点:I/0 3.C#知识点:is和as 4. ...
- static dictionary methods of text compression
Now I will introduce a way to compress a text. When we are confronted with numerous data, and the da ...
- Messenger与AIDL的异同
Messenger与AIDL的异同 最近做项目需要使用进程间通信,大家知道应用层的进程间通信无非Broadcast,Activity,Service,Content Provider四大组件.Broa ...