UINavigation栏标题字体大小横向



无论如何,我可以在横向模式下设置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]];

不幸的是,我没有看到任何barMetric:属性可以与setTitleAttributes:一起使用。

谢谢。

因此,

在网上进行了一些研究后,我发现字体大小必须设置为0,以确保字体在横向和纵向中自动设置为适当的大小:

[UIFont fontWithName:@"Awesome-Bold" size:0], UITextAttributeFont

最新更新