popToRootViewControllerAnimated 并释放所有视图
我有一个 UINavigationController ,它要求提供一些信息,并且用户导航直到最后,一旦到达那里,他们就可以接受或取消已输入的所有数据。
他们选择哪个选项并不重要,因为他们总是会使用第一个视图。
[UINavigationController popToRootViewControllerAnimated:]
问题是,我如何释放/取消分配所有视图?
例如,他们从视图1开始,结束在视图8,一旦他们从8直接转到1,我如何释放视图2,3,4,5,6,7,8?
谢谢,
问候,
M。
I have a UINavigationController that asks for some information and the user navigates until the end, once there, they can Accept or Cancel all the data that has been entered.
It doesn't matter wich option they choose, as they always will go to the first view using
[UINavigationController popToRootViewControllerAnimated:]
The question is, how I can release/deallocate all the views ?
For example, they start for view 1 and the end is at view 8, once they go directly to the 1 from the 8, how I can release view 2,3,4,5,6,7,8 ?
thanks,
regards,
m.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需允许导航控制器为您处理内存 - 它保留推送到其堆栈的控制器并在删除时释放它们。因此,如果您在其他任何地方都不拥有控制器的所有权,它们将从导航控制器弹出后自动释放。基本上你应该按如下方式推送控制器:
Just allow navigation controller to handle memory for you - it retains controller pushed to its stack and releases them on remove. So if you do not take ownership of your controllers anywhere else they will be deallocated automatically after popped from navigation controller. Basically you should push controllers as follows: