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.
所以经过网上研究后我发现字体大小必须设置为0
,这样可以确保字体在横向和纵向中自动设置为合适的大小:
[UIFont fontWithName:@"Awesome-Bold" size:0], UITextAttributeFont
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.