Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationBar title font size in landscape

Is there anyway I can set the font size for the UINavigationBar title in landscape mode?

I'm using the UIAppearance proxy to customize the title text attributes and I am specifically interested in the font size when in landscape. It's font in portrait but when rotating to landscape the font size does not shrink as the default behaviour.

[[UINavigationBar appearance] setTitleTextAttributes:[[NSDictionary alloc] initWithObjectsAndKeys:
                                           [UIFont fontWithName:@"Awesome-Bold" size:20], UITextAttributeFont,
                                           [UIColor colorWithWhite:0.0f alpha:0.2f], UITextAttributeTextShadowColor,
                                           [NSValue valueWithUIOffset:UIOffsetMake(0.0f, -1.0f)], UITextAttributeTextShadowOffset,
                                           [UIColor whiteColor], UITextAttributeTextColor,
                                           nil]];

Unfortunately I don't see any barMetric: property to go along with setTitleAttributes:.

Thanks.

like image 208
runmad Avatar asked Dec 04 '12 02:12

runmad


1 Answers

So after researching a bit online I find out the font size has to be set to 0 which ensures the font is automatically set to the appropriate size in landscape and portrait:

[UIFont fontWithName:@"Awesome-Bold" size:0], UITextAttributeFont
like image 123
runmad Avatar answered Oct 09 '22 08:10

runmad