Unable to update view when app goes into background in iOS 7 using applicationDidEnterBackground:

StackOverflow https://stackoverflow.com/questions/18937313

سؤال

When my app goes into the background, I'm changing the view to prepare it for coming back into the foreground. In iOS 6, what I'm doing works fine. However in iOS 7, it is not working.

I'm trying to hide and show some UILabels like this:

//AppDelegate.m
- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self.timerVc hideTimerLabels];
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    [self.timerVc showTimerLabels];
}


//TimerVC.m
- (void)hideTimerLabels {
    for (UILabel *label in self.timerLabels) {
        label.hidden = YES;
    }
}

- (void)showTimerLabels {
    for (UILabel *label in self.timerLabels) {
        label.hidden = NO;
    }
}

All of this code is firing when I set breakpoints, but doesn't seem to do anything. I've also tested the hideTimerLabels and showTimerLabels methods and they work fine in iOS 7.

هل كانت مفيدة؟

المحلول

It looks like this is only happening in the simulator. On an actual device with iOS 7, it works as expected. Another reminder, to test on the device more often.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top