gpt4 book ai didi

iOS:有没有办法以编程方式以特定字体设置 Storyboard的所有字体?

转载 作者:行者123 更新时间:2023-11-28 19:28:45 27 4
gpt4 key购买 nike

我想知道是否有一种简单的方法可以更改 StoryBoard 中所有标签、 TextView 、按钮、talbeviewcell 等的字体,而无需将它们添加到 View Controller 中?

我现在手动完成,但我想知道是否存在简单的解决方案?

enter image description here

最佳答案

在代码中试试这个
swift

 UILabel.appearance().defaultFont = UIFont.systemFont(ofSize: 25)

更新:
Obj-c(不改变大小):放在开头:

@implementation UILabel(SizedFontName)
- (void)setSizedFontName:(NSString *)name UI_APPEARANCE_SELECTOR
{
self.font = [UIFont fontWithName:name size:self.font.pointSize];
}
@end

在 viewDidLoad 中:

[[UILabel appearance] setSizedFontName:@"RenaultLife"];

关于iOS:有没有办法以编程方式以特定字体设置 Storyboard的所有字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48580666/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com