UINavigationBar字体属性似乎只调整标题,但不是调整视图的breacrumbs部分

时间:2015-06-01 14:18:53

标签: ios uinavigationcontroller

我在AppDelegate.m中使用以下内容来更改UINavigationBar的字体属性:

[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                           [UIColor darkBlue], NSForegroundColorAttributeName,
                                                           [UIFont fontWithName:SYSTEM_FONT_TYPE size:SYSTEM_FONT_SIZE*1.2], NSFontAttributeName, nil]];

然而,这似乎只调整标题显示字体,而不是面包屑回溯部分:

menu image

查看类引用,我必须错过它,因为除了与TitleTextAttributes相关的属性或方法之外,我没有看到任何其他引用的属性或方法。我还应该更改哪些内容来更改左侧文字的字体?

1 个答案:

答案 0 :(得分:1)

UIBarButtonItem *backbutton =  [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:nil action:nil];    

[backbutton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor darkBlue],UITextAttributeTextColor,[UIFont fontWithName:TEXTFONT size:16.0f],UITextAttributeFont, nil] forState:UIControlStateNormal]; 

或者,

[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor darkBlue],[UIFont fontWithName:TEXTFONT size:16.0f],UITextAttributeFont, nil] forState:UIControlStateNormal];