There's no need to swizzle UIApplication
. Just subclass UIApplication
and provide your own implementation of preferredContentSizeCategory
:
Swift:
class MyApplication: UIApplication {
override var preferredContentSizeCategory: UIContentSizeCategory {
get { return UIContentSizeCategory.large }
}
}
UIApplicationMain(
CommandLine.argc,
CommandLine.unsafeArgv,
NSStringFromClass(MyApplication.self),
NSStringFromClass(AppDelegate.self)
)
Objective-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]));
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…