1
這是我簡單的batteryLevel測試應用程序的簡單代碼。如何獲得確切的電池電量?
- (void)viewDidLoad
{
[super viewDidLoad];
UIDevice *device = [UIDevice currentDevice];
device.batteryMonitoringEnabled = YES;
mLabel.text = [NSString stringWithFormat:@"%0.5f",device.batteryLevel];
}
這是我的應用程序的形象,希望你能看到狀態欄電池電量和我的應用程序電量。我不知道爲什麼這些水平是不同的....? 一個是99%和應用程式水平是0.95這實際上是95%