ios - 更改 UIImagePickerController 标签的字体
<p><p>我的目标是控制 UIImagePickerController 中所有文本的字体。</p>
<p>我以前使用 UILabel 扩展和外观代理来控制所有 UILabel 的字体。 </p>
<pre><code>extension UILabel {
var defaultFontName : String {
get { return self.font.fontName }
set { self.font = UIFont(name: newValue, size: self.font.pointSize) }
}
</code></pre>
<p>我在 AppDelegate 中设置了默认字体。</p>
<pre><code>UILabel.appearance().defaultFontName = kDefaultFontName
</code></pre>
<p>以前,这扩展到了我在项目中以编程方式创建的 UIImagePickerController,所有单元格和图像标签都采用默认字体。更新 Xcode 9 和 Swift 4 后,这不起作用。</p>
<p>我尝试专门为 UIImagePickerControllerClass 中包含的 UILabel 调整外观代理,并为默认字体指定特定的磅值,但没有成功。 </p>
<p>为什么这不再起作用了?</p>
<p>如何访问 UIImagePickerController 中的字体?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您不应使用此类技巧来更改系统行为。因为即使你让这个 hacky 技巧起作用,它肯定会在 iOS 12 中被破坏。所以现在,它不起作用,因为 .appearence。系统 Controller ,如图像选择器是单独创建的,不使用外观来创建它们自己的。从ios11开始。但在 ios10 中,文档中有类似警告</p></p>
<p style="font-size: 20px;">关于ios - 更改 UIImagePickerController 标签的字体,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/46959561/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/46959561/
</a>
</p>
页:
[1]