iOS获取电量方法

ios简单的方法:

[UIDevice currentDevice].batteryMonitoringEnabled = YES;
double deviceLevel = [UIDevice currentDevice].batteryLevel;

 获取当前剩余电量, 我们通常采用上述方法。这也是苹果官方文档提供的。

它返回的是0.00-1.00之间的浮点值。 另外, -1.00表示模拟器。

 

原文地址:https://www.cnblogs.com/zhujin/p/4015868.html