Hello there, I am having a small problem. I am a beginner to iPhone programming so please forgive me if the answer is obvious.
I have found the current charge and want it to continually update while my app is running. I tried this:
- (void) viewWillAppear:(BOOL)animated
{
NSLog(@"viewWillAppear");
double level = [self batteryLevel];
currentCharge.text = [NSString stringWithFormat:@"%.2f %%", level];
timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:selfselector:@selector(updateBatteryLevel:) userInfo:nil repeats:NO];
[super viewWillAppear:animated];
}
I am correctly getting the reading initially, but it is not updating. Any help would be much appreciated!
Many thanks,
Stuart