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的字体颜色为×××,怎么样简单吧。