2

外观协议仅更改导航栏标题的字体。

iOS 5

4

1 回答 1

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];
于 2012-10-22T00:10:05.233 回答