I have an UINavigationBar added to my UIViewController view. I want to change the fonts properties. Note that I want to change a UINavigationBar not controller. In my app wh
(This is not possible using the new iOS 5.0 Appearance API).
Edit:
iOS >= 5.0 :
Set the Title Text Attributes for the Navigationbar:
// Customize the title text for *all* UINavigationBars
NSDictionary *settings = @{
UITextAttributeFont : [UIFont fontWithName:@"YOURFONTNAME" size:20.0],
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor : [UIColor clearColor],
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetZero]};
[[UINavigationBar appearance] setTitleTextAttributes:settings];
iOS < 5.0
UINavigationItem doesn't have a property called label or something, only a titleView. You are only able to set the font by setting a custom label as this title view You could use the following code: (as suggested here)
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
label.font = [UIFont fontWithName:@"YOURFONTNAME" size:20.0];
label.shadowColor = [UIColor clearColor];
label.textColor =[UIColor whiteColor];
label.text = self.title;
self.navigationItem.titleView = label;
[label release];