【问题标题】:Unable to update view when app goes into background in iOS 7 using applicationDidEnterBackground:当应用程序在 iOS 7 中使用 applicationDidEnterBackground 进入后台时无法更新视图:
【发布时间】:2023-03-19 22:15:01
【问题描述】:

当我的应用程序进入后台时,我正在更改视图以准备将其返回到前台。在 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 objective-c background ios7 foreground


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多