首页 > 其他 > 详细

navigationBar上的字体颜色

时间:2014-03-08 22:52:12      阅读:506      评论:0      收藏:0      [点我收藏+]

titleTextAttributes(ios5.0以后可用)

  这是UINavigationBar的一个属性,通过它你可以设置title部分的字体,这个属性定义如下:

/* You may specify the font, text color, text shadow color, and text shadow offset for the title in the text attributes dictionary, using the keys found in UIStringDrawing.h. */
@property(nonatomic,copy) NSDictionary *titleTextAttributes __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;

  它的dictionary的key定义以及其对应的value类型如下:

//    Keys for Text Attributes Dictionaries//    NSString *const UITextAttributeFont;                       value: UIFont//    NSString *const UITextAttributeTextColor;                 value: UIColor//    NSString *const UITextAttributeTextShadowColor;       value: UIColor//    NSString *const UITextAttributeTextShadowOffset;      value: NSValue wrapping a UIOffset struct.

  下面看一个简单的例子:

NSDictionary *dict = [NSDictionary dictionaryWithObject:[UIColor yellowColor] forKey:UITextAttributeTextColor];
childOne.navigationController.navigationBar.titleTextAttributes = dict;

  这个例子就是设置title的字体颜色为黄色,怎么样简单吧。


navigationBar上的字体颜色,布布扣,bubuko.com

navigationBar上的字体颜色

原文:http://8399249.blog.51cto.com/8389249/1370823

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!