忽略iOS中的动态类型:辅助功能 [英] Ignoring the dynamic type in iOS: Accessibility

查看:208
本文介绍了忽略iOS中的动态类型:辅助功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法完全忽略iOS应用中的动态类型/字体大小设置?
我的意思是有一种方式像plist条目,所以我可以完全禁用它。据我所知,只要设置发生变化,我们就可以观察并重新配置字体。我正在寻找一个更简单的解决方案。我正在使用iOS8。
谢谢。

Is there a way to completely ignore dynamic type/font size settings in iOS apps? I mean is there a way like a plist entry so that I can disable it completely. I understand there is a notification we can observe and re-configure the font whenever there is change in the settings. I am looking for a simpler solution. I am using iOS8. Thanks.

推荐答案

快速相当于@含义的回答如下:

The swift equivalent to the answer of @meaning-matters looks as follows:

在你的AppDelegate中:

In your AppDelegate:

@objc func swizzled_preferredContentSizeCategory() -> UIContentSizeCategory {
    return UIContentSizeCategory.small
}

open func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let originalMethod = class_getInstanceMethod(UIApplication.self, #selector(preferredContentSizeCategory))
    let swizzledMethod = class_getInstanceMethod(UIApplication.self, #selector(swizzled_preferredContentSizeCategory))
    method_exchangeImplementations(originalMethod, swizzled_preferredContentSizeCategory)
}

这篇关于忽略iOS中的动态类型:辅助功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆