Skip to content

Instantly share code, notes, and snippets.

@lyonanderson
Created March 26, 2015 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyonanderson/a92b7592fe94ef7cc62c to your computer and use it in GitHub Desktop.
Save lyonanderson/a92b7592fe94ef7cc62c to your computer and use it in GitHub Desktop.
Show detailed battery info
NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PreferenceBundles/BatteryUsageUI.bundle"];
[bundle load];
Class BatteryUsageQueryModuleClaszz = NSClassFromString(@"BatteryUsageQueryModule");
Class BatteryUIControllerClazz = NSClassFromString(@"BatteryUIController");
if (BatteryUIControllerClazz) {
self.batteryUIController = (BatteryUIController*)[[BatteryUIControllerClazz alloc] init];
[self.batteryUIController setBatteryUIType:2];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.batteryUIController];
[self presentViewController:navController animated:YES completion:^{
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment