UINavigationBar横向标题字体大小

run*_*mad 7 uinavigationbar uifont ios uiappearance

无论如何我可以UINavigationBar在横向模式下设置标题的字体大小吗?

我正在使用UIAppearance代理来自定义标题文本属性,而我在横向时对字体大小特别感兴趣.它是纵向字体,但在旋转到横向时,字体大小不会缩小为默认行为.

[[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]];
Run Code Online (Sandbox Code Playgroud)

不幸的是,我没有看到任何barMetric:财产setTitleAttributes:.

谢谢.

run*_*mad 8

因此,经过在线研究后,我发现必须设置字体大小,以0确保字体在横向和纵向中自动设置为适当的大小:

[UIFont fontWithName:@"Awesome-Bold" size:0], UITextAttributeFont
Run Code Online (Sandbox Code Playgroud)