7

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.

4

1 に答える 1

8

したがって、オンラインで少し調査した後、フォントサイズを設定する必要があることがわかりまし0た。これにより、フォントは横向きと縦向きで適切なサイズに自動的に設定されます。

[UIFont fontWithName:@"Awesome-Bold" size:0], UITextAttributeFont
于 2012-12-04T02:15:59.937 に答える