当 iOS 应用程序从非活动/挂起状态被召回时,何时刷新视图
Posted
技术标签:
【中文标题】当 iOS 应用程序从非活动/挂起状态被召回时,何时刷新视图【英文标题】:When to refresh a view when iOS app is being recalled from inactive/suspended 【发布时间】:2012-03-09 14:01:52 【问题描述】:我的应用在视图中包含时间敏感信息,当用户从非活动/暂停状态调用应用时,这些信息需要更新。下面的两个应用程序委托方法中的哪一个应该处理这个问题?
这里:
- (void)applicationDidBecomeActive:(UIApplication *)application
//Check to see if we need to refresh a view
if([self needToRefreshView])
[viewcontroller1 refreshView];
或
这里:
- (void)applicationWillEnterForeground:(UIApplication *)application
//Check to see if we need to refresh a view
if([self needToRefreshView])
[viewcontroller1 refreshView];
一种方法比另一种更适合这个吗?如果是,为什么?
谢谢
【问题讨论】:
好苹果资源在这里:developer.apple.com/library/ios/#documentation/iphone/… 【参考方案1】:这些应该都可以正常工作,我会考虑在其中实现您的代码的唯一其他方法是viewWillAppear
。
【讨论】:
以上是关于当 iOS 应用程序从非活动/挂起状态被召回时,何时刷新视图的主要内容,如果未能解决你的问题,请参考以下文章