Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > iPhone, iPod and iPad > iOS > iOS 6

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 11, 2012, 12:10 PM   #1
ApolloX
macrumors newbie
 
Join Date: Feb 2007
Best Way to Monitor Battery Level

I'm developing an iOS that for display reasons requires full screen, but I'd still like to have a battery indicator present on screen for the user.

One simple solution is to create a timer that updates the battery indicator on screen every X number of seconds such as:

Code:
[[UIDevice currentDevice] setBatteryMonitoringEnabled:true];
[NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(setBatteryIndicator) userInfo:nil repeats:YES];
Is there a better approach way? Should I be using a notification system to receive notifications every time the battery changes? Anyone have a code snippet that is better than the approach I'm using?

Last edited by SandboxGeneral; Nov 11, 2012 at 12:35 PM. Reason: Added code tags
ApolloX is offline   0 Reply With Quote
Old Nov 11, 2012, 01:55 PM   #2
mnemonix
macrumors regular
 
Join Date: Jun 2005
Me thinks you might want to post this over here ->
mnemonix is offline   0 Reply With Quote

Reply
MacRumors Forums > iPhone, iPod and iPad > iOS > iOS 6

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:17 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC