博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
设置UINavigationController标题的属性
阅读量:7195 次
发布时间:2019-06-29

本文共 4436 字,大约阅读时间需要 14 分钟。

设置UINavigationController标题的属性

self.title = @"产品详情";    [self.navigationController.navigationBar setTitleTextAttributes:\     [NSDictionary dictionaryWithObjectsAndKeys:      [UIColor redColor],             NSForegroundColorAttributeName,      [UIFont systemFontOfSize:20.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) 12UIKIT_EXTERN NSString *const NSParagraphStyleAttributeName NS_AVAILABLE_IOS(6_0);      // NSParagraphStyle, default defaultParagraphStyleUIKIT_EXTERN NSString *const NSForegroundColorAttributeName NS_AVAILABLE_IOS(6_0);     // UIColor, default blackColorUIKIT_EXTERN NSString *const NSBackgroundColorAttributeName NS_AVAILABLE_IOS(6_0);     // UIColor, default nil: no backgroundUIKIT_EXTERN NSString *const NSLigatureAttributeName NS_AVAILABLE_IOS(6_0);            // NSNumber containing integer, default 1: default ligatures, 0: no ligaturesUIKIT_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 strikethroughUIKIT_EXTERN NSString *const NSUnderlineStyleAttributeName NS_AVAILABLE_IOS(6_0);      // NSNumber containing integer, default 0: no underlineUIKIT_EXTERN NSString *const NSStrokeColorAttributeName NS_AVAILABLE_IOS(6_0);         // UIColor, default nil: same as foreground colorUIKIT_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 shadowUIKIT_EXTERN NSString *const NSTextEffectAttributeName NS_AVAILABLE_IOS(7_0);          // NSString, default nil: no text effectUIKIT_EXTERN NSString *const NSAttachmentAttributeName NS_AVAILABLE_IOS(7_0);          // NSTextAttachment, default nilUIKIT_EXTERN NSString *const NSLinkAttributeName NS_AVAILABLE_IOS(7_0);                // NSURL (preferred) or NSStringUIKIT_EXTERN NSString *const NSBaselineOffsetAttributeName NS_AVAILABLE_IOS(7_0);      // NSNumber containing floating point value, in points; offset from baseline, default 0UIKIT_EXTERN NSString *const NSUnderlineColorAttributeName NS_AVAILABLE_IOS(7_0);      // UIColor, default nil: same as foreground colorUIKIT_EXTERN NSString *const NSStrikethroughColorAttributeName NS_AVAILABLE_IOS(7_0);  // UIColor, default nil: same as foreground colorUIKIT_EXTERN NSString *const NSObliquenessAttributeName NS_AVAILABLE_IOS(7_0);         // NSNumber containing floating point value; skew to be applied to glyphs, default 0: no skewUIKIT_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 expansionUIKIT_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.

 

 

 

 

 

转载地址:http://rgvkm.baihongyu.com/

你可能感兴趣的文章
windows server 2012 QQ交流群:256418966
查看>>
[转]SQLiteOpenHelper
查看>>
QT在CT上的安装及运行
查看>>
Entity Framework 使用注意:Where查询条件中用到的关联实体不需要Include
查看>>
有用网站
查看>>
Android——事件处理模型一(基于回调机制的事件处理)(转)
查看>>
win8 64位+Oracle 11g 64位下使用PL/SQL Developer 的解决办法
查看>>
【转】iOS自动布局进阶用法
查看>>
其实没那么复杂!探究react-native通信机制
查看>>
利用 IHttpModule 自定义 HTTP 处理模块
查看>>
数据挖掘十大经典算法[转]
查看>>
构建高性能web之路------工具和环境准备篇(转)
查看>>
解决SharePoint中GridView导出Excel按钮的问题
查看>>
Linux上的管道信号SIGPIPE
查看>>
仿百度文库方案[openoffice.org 3+swftools+flexpaper](八) 之 常见问题集FAQ
查看>>
JBoss发布Hibernate 4.0
查看>>
详解Linux系统下ADSL拨号上网方法
查看>>
实验室博客
查看>>
GC这篇文章介绍得很基本
查看>>
Windows Tftpd32 DHCP服务器 使用
查看>>