当我的应用程序进入后台时,我正在更改 View 以准备它返回前台。在 iOS 6 中,我所做的工作正常。但是在 iOS 7 中,它不起作用。
我试图像这样隐藏和显示一些 UILabel:
//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;
}
}
当我设置断点时,所有这些代码都在触发,但似乎什么也没做。我还测试了 hideTimerLabels
和 showTimerLabels
方法,它们在 iOS 7 中运行良好。
最佳答案
看起来这只发生在模拟器中。在装有 iOS 7 的实际设备上,它按预期工作。另一个提醒,要更频繁地在设备上进行测试。
关于ios - 在 iOS 7 中使用 applicationDidEnterBackground : 应用程序进入后台时无法更新 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18937313/