ios - 在 iOS 7 中使用 applicationDidEnterBackground : 应用程序进入后台时无法更新 View

标签 ios objective-c background ios7 foreground

当我的应用程序进入后台时,我正在更改 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;
    }
}

当我设置断点时,所有这些代码都在触发,但似乎什么也没做。我还测试了 hideTimerLabelsshowTimerLabels 方法,它们在 iOS 7 中运行良好。

最佳答案

看起来这只发生在模拟器中。在装有 iOS 7 的实际设备上,它按预期工作。另一个提醒,要更频繁地在设备上进行测试。

关于ios - 在 iOS 7 中使用 applicationDidEnterBackground : 应用程序进入后台时无法更新 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18937313/

相关文章:

java - 没有重复的视差滚动 |游戏

java - 后台java进程不退出

ios - 枚举字符串而不是 int

ios - 多点连接崩溃尝试从对象 [2] 插入零对象

iphone - 网络故障后如何保存并重试报告 GKAchievement?

iphone - 更改每个导航上的导航栏背景图像

ios - UIImageView 动画减少宽度

ios - Collectionview segue View 不在窗口层次结构中

ios - 返回 CGValues 导致 Xcode 错误

ios - 在 XCode 6.1 中工作的代码在 XCode 6.3 中不起作用