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:
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?
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 a moderator: