【发布时间】:2011-07-16 16:53:53
【问题描述】:
我的应用在堆栈中有多个 UIViewController(在 UINavigationController 下)。在某些情况下,当我在内部 UIViewControllers 中时,我会收到内存警告(通常在设备因后台运行的其他应用程序而过载时发生)。当这些内存警告发生时,应用程序会继续运行(大多数情况下),然后当它返回到 rootViewController 时,它会重新加载它,但不会填充视图对象(主要是 UIButton 图像)。
我希望实现didReceiveMemoryWarning 和applicationDidReceiveMemoryWarning,但我不清楚如何实现。
我正在寻找的最终结果是,当应用程序在内存警告后执行此“重新加载”时,它将“重新加载”rootViewController,处于与用户开始“潜入”内部 UIViewControllers 之前相同的状态。
- 应该如何实现?
- 我应该在每个 UIViewController 中实现默认的
didReceiveMemoryWarning吗? - 由于内存警告总是发生在内部 UIViewControllers 中,我应该如何让
rootViewController知道它应该运行didReceiveMemoryWarning? - 我如何告诉
rootViewController它应该进行哪些设置?换句话说 - 我可以将设置保留在didReceiveMemoryWarning不会删除它们的地方,并在激活didReceiveMemoryWarning时“召回”它们,以便用户看到他们开始“关卡导航”的屏幕吗?
【问题讨论】:
标签: ios cocoa-touch didreceivememorywarning