导航中使用外部字体“FuturaStd-Book”截断的标题。
尝试使用以下代码减小字体大小,但标题仍然被截断。
[[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"FuturaStd-Book" size:16]}];
请帮我解决这个...
最佳答案
以下代码对齐 navigationItem
标题。 (仅适用于 iOS 11 - 但向后导航和标题 y 位置不同)
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
style.alignment = NSTextAlignmentCenter;
style.firstLineHeadIndent = 1.0f;
style.lineSpacing = 2; //Change spacing between lines
style.paragraphSpacing = 2; //Change space between paragraphs
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor],
NSBackgroundColorAttributeName:[UIColor clearColor],
NSFontAttributeName:[UIFont fontWithName:@"FuturaStd-Book" size:18],
NSParagraphStyleAttributeName: style }];
关于ios - 导航标题用外部字体切碎 'FuturaStd-Book',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48088812/