2013-05-02 67 views

回答

1

这里是你如何能得到电池级

UIDevice *device = [UIDevice currentDevice]; 
[device setBatteryMonitoringEnabled:YES]; 
float level = [device batteryLevel]; 
+0

我知道如何在iPhone电池电量的例子,但我想知道我是否连接两个BLE支持设备与整个一天,它应该不是电池很快就会耗尽。 – ganesh 2013-05-02 11:06:49

+0

你可以处理UIDeviceBatteryLevelDidChangeNotification通知,只需将代码添加到你的viewDidLoad [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryLevelChanged :) name:UIDeviceBatteryLevelDidChangeNotification object:nil]; – taffarel 2013-05-02 11:33:19

+0

Hai taffarel谢谢你的回复,它非常有用,可以找到我想要的电池电量,我会检查这个 – ganesh 2013-05-02 11:47:02