防止iOS 11上的dynamictypes更改

为了防止iOS的dynamictypes系统弄乱我使用的应用程序布局:

#import <objc/runtime.h> ... NSString* swizzled_preferredContentSizeCategory(id self, SEL _cmd) { return UIContentSizeCategoryExtraLarge; } ... Method originalMethod = class_getInstanceMethod([UIApplication class], @selector(preferredContentSizeCategory)); method_setImplementation(originalMethod, (IMP)swizzled_preferredContentSizeCategory); 

将文本修复到一个很好的大尺寸。

这不再适用于iOS 11.我应该做什么/添加使这项工作再次?

我find了这个,并添加了UITraitCollectionpreferredContentSizeCategory ,但是这并没有改变任何东西。