0

I am trying to make an app that detects the battery percentage of the device.

However I only get my battery percentage in multiples of 5 from this following code:

float batteryLevel = [[UIDevice currentDevice] batteryLevel];

batteryLevel *= 100;

labelPercentage.text = [[NSString alloc] initWithFormat:@"%2.f", batteryLevel];

How do I display it in multiples of 1, what would be a separate framework that I may use?

Kara
  • 6,115
  • 16
  • 50
  • 57
user3647176
  • 201
  • 1
  • 2
  • 6
  • @JustinJohns Nup does not work! – user3647176 May 27 '14 at 02:17
  • Without jailbreaking, 5% is as precise as you get. See the linked duplicate answer for discussion of getting 1% accuracy after jailbreaking, alternative method doing image processing on the status bar battery meter etc. – Adam Eberbach May 27 '14 at 02:26

0 Answers0