Best Way to Monitor Battery Level

Discussion in 'iOS 6' started by ApolloX, Nov 11, 2012.

  1. ApolloX, Nov 11, 2012
    Last edited by a moderator: Nov 11, 2012

    ApolloX macrumors newbie

    Feb 1, 2007
    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:

    [[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?
  2. mnemonix macrumors regular

    Jun 23, 2005

Share This Page