忽略 iOS 中的动态类型:辅助功能 [英] Ignoring the dynamic type in iOS: Accessibility
问题描述
有没有办法完全忽略 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.
推荐答案
无需混淆 UIApplication
.只需继承 UIApplication
并提供您自己的 preferredContentSizeCategory
实现:
There's no need to swizzle UIApplication
. Just subclass UIApplication
and provide your own implementation of preferredContentSizeCategory
:
斯威夫特:
class MyApplication: UIApplication {
override var preferredContentSizeCategory: UIContentSizeCategory {
get { return UIContentSizeCategory.large }
}
}
UIApplicationMain(
CommandLine.argc,
CommandLine.unsafeArgv,
NSStringFromClass(MyApplication.self),
NSStringFromClass(AppDelegate.self)
)
目标-C:
@interface MyApplication : UIApplication
@end
@implementation MyApplication
- (UIContentSizeCategory) preferredContentSizeCategory
{
return UIContentSizeCategoryLarge;
}
@end
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, NSStringFromClass([MyApplication class]), NSStringFromClass([AppDelegate class]));
}
}
这篇关于忽略 iOS 中的动态类型:辅助功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!