复制代码 - (void)applicationDidFinishLaunching:(UIApplication *)application { Method m1 = class_getInstanceMethod([UIApplication class], @selector(didTurnOnDisplay)); Method m2 = class_getInstanceMethod([UIApplication class], @selector(didTurnOffDisplay)); Method m3 = class_getInstanceMethod([UIApplication class], @selector(handleDidTurnOnDisplay)); Method m4 = class_getInstanceMethod([UIApplication class], @selector(handleDidTurnOffDisplay)); method_exchangeImplementations(m1, m3); method_exchangeImplementations(m2, m4); [window makeKeyAndVisible]; }