如何列出所有实时(未释放的)UIViewControllers? [英] How to list all live (non-deallocated) UIViewControllers?

查看:26
本文介绍了如何列出所有实时(未释放的)UIViewControllers?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些 UIViewController 似乎没有被释放.

Some UIViewControllers do not seem to get deallocated.

列出和识别所有活动的(未释放的)UIViewController 的最佳方法是什么?

What's the best way to list and identify all live (non-deallocated) UIViewControllers?

推荐答案

在调试器中运行应用程序并使用调试内存图"按钮 并查看视图控制器列表面板左侧.如果您碰巧遵循在视图控制器名称中包含 ViewController 的约定(例如 MainViewControllerDetailsViewController 等),您可以通过在左侧面板底部的过滤器"文本框中键入 ViewController 来过滤左侧面板中列出的对象列表:

Run app in debugger and use "Debug memory graph" button and see the list of the view controllers in the panel on the left. If you happened to follow the convention of including ViewController in the name of your view controllers (e.g. MainViewController, DetailsViewController, etc.), you can filter the list of objects listed in the left panel by typing ViewController in the "filter" text box at the bottom of the left panel:

在这个例子中,我还点击了我的第三个视图控制器,我可以看到它是由第二个呈现的,而第二个是由第一个呈现的.

In this example, I also clicked on my third view controller, and I can see it was presented by the second one, which was presented by the first one.

另一种方法是使用视图调试器",但这仅显示当前存在于活动视图控制器层次结构中的视图控制器,可能不会显示视图控制器其视图当前不可见,因为视图控制器以模态方式呈现了另一个视图控制器.

The other approach is to use the "view debugger" , but that only shows the view controllers that are currently present in the active view controller hierarchy and may not show view controllers whose views are not currently visible because the view controller presented another view controller modally.

这篇关于如何列出所有实时(未释放的)UIViewControllers?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆