【发布时间】:2012-05-07 10:28:03
【问题描述】:
我有ViewController,由于某些原因,我必须从 AppDelegate.m 设置 label.text
我该怎么做?
我已尝试使用此代码,但没有成功:
- (void)applicationWillEnterForeground:(UIApplication *)application
{
HomeViewController *home = [[HomeViewController alloc] init];
home.dateCreatedLabel.text = @"date createdddd";
}
我必须将其放入 AppDelegate 的原因是因为我从网站获取 JSON,我也必须在 applicationWillEnterForeground: 中执行此操作以检查每次更新,我解决了更新核心数据但没有如何更改标签的问题。文本。
或者我能不能强制HomeViewController刷新?
【问题讨论】:
-
不需要,因为它是自我解释的
-
我无法想象从 AppDelegate 设置标签的原因。你能详细说明你为什么这样做吗?
标签: ios uiviewcontroller uiapplicationdelegate