2013-05-02 58 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