设置UINavigationController标题的属性
属性 设置 标题
2023-09-14 08:57:17 时间
设置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) 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, its always horizontal. The behavior for any other value is undefined.
相关文章
- html的lang属性有什么用吗
- 父元素opacity属性对子元素的影响(子元素设置opacity无效)
- 属性选择器与类选择器_input属性选择器
- 【说站】css中counter-reset属性是什么
- 解决HTML select控件 设置属性 disabled 后无法向后台传值的方法
- 如何通过反射获取属性的名字和属性类型
- 【Linux 内核】CPU 分类与状态 ( CPU 处理器分类 | 根据物理属性分类 SMT、MC、SoC | Linux 内核中 CPU 分类 | Linux 内核源码中的 CPU 状态源码 )
- python3 解析 json 字符串并返回支持属性访问的对象
- [android] 手机卫士自定义控件的属性详解手机开发
- js常用属性详解编程语言
- springmvc 项目完整示例05 日志 –log4j整合 配置 log4j属性设置 log4j 配置文件 log4j应用详解编程语言
- MySQL数据库:属性设置指南(mysql数据库属性设置)
- JSP PageContext.setAttribute()方法:设置属性
- Hibernate connection.username属性:指定数据库连接用户名
- Hibernate hibernate.max_fetch_depth属性:设置抓取深度
- JS setAttribute()方法:设置元素的属性值
- JS元素属性的获取和设置
- 动态管理Oracle中的会话属性(oracle中的动态会话)
- jquery下动态显示jqGrid以及jqGrid的属性设置容易出现问题的解决方法
- 原生javascript获取元素样式属性值的方法
- Javascript的数组与字典用法与遍历对象的属性技巧
- TextArea设置MaxLength属性最大输入值的js代码
- 判断JS对象是否拥有某种属性的两种方式
- 浅析js设置控件的readonly与enabled属性问题