外观协议仅更改导航栏标题的字体。
iOS 5
答案 0 :(得分:11)
您必须为UINavigationBar树使用UIBarButtonItem的外观协议:
UIBarButtonItem *barButtonItemProxy = [UIBarButtonItem appearanceWhenContainedIn:
[UINavigationBar class], [UINavigationController class], nil];
NSDictionary *textAttributes = @{
UITextAttributeFont : [UIFont boldSystemFontOfSize:12.0f],
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor : [UIColor blackColor],
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake(0.0f, -1.0f)]
};
[barButtonItemProxy setTitleTextAttributes:textAttributes forState:UIControlStateNormal];