【发布时间】: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;
}
}
当我设置断点时,所有这些代码都会触发,但似乎没有做任何事情。我还测试了 hideTimerLabels 和 showTimerLabels 方法,它们在 iOS 7 中运行良好。
【问题讨论】:
标签: ios objective-c background ios7 foreground