iOS 自定義電池圖標的時候,獲取剩余電量的方法。
[UIDevice currentDevice].batteryMonitoringEnabled = YES;
double deviceLevel = [UIDevice currentDevice].batteryLevel;
如果值是-1的話,表示用的是模擬器
iOS 自定義電池圖標的時候,獲取剩余電量的方法。
[UIDevice currentDevice].batteryMonitoringEnabled = YES;
double deviceLevel = [UIDevice currentDevice].batteryLevel;
如果值是-1的話,表示用的是模擬器