gpt4 book ai didi

ios - 更改 UIPrintInteractionController 的字体

转载 作者:行者123 更新时间:2023-11-30 12:27:07 25 4
gpt4 key购买 nike

我有一个以编程方式创建的 UIPrintInteractionController。它设置为从我的服务器中提取 pdf,并打印所述 pdf。我的问题是如何更改 View 的字体。我已经在我的应用程序委托(delegate)中设置了导航栏字体(因此该字体出现在所有 View 上),但这不适用于该 View 。任何帮助是极大的赞赏。谢谢!

最佳答案

我明白了。像这样创建 UILabel 的扩展

extension UILabel {
var substituteFontName : String {
get { return self.font.fontName }
set { self.font = UIFont(name: newValue, size: self.font.pointSize) }
}
}

在 AppDelegate.swift 中,使用此扩展来更改整个应用程序中每个标签的字体,包括 UIPrinterInteractionController。

UILabel.appearance().substituteFontName = "Font Name Here"

一石二鸟。

关于ios - 更改 UIPrintInteractionController 的字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44048840/

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