在Xcode中调试时,我可以在应用程序中看到我的视图层次结构吗? [英] Can I see the view hierarchy I have in my app while debugging in Xcode?

查看:248
本文介绍了在Xcode中调试时,我可以在应用程序中看到我的视图层次结构吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试我的iOS应用程序,因为我有一个视图推送/解除调用,我想确保我的堆栈中没有任何我不希望的视图。是否有可能在Xcode调试器中看到这一点?

I am debugging my iOS app and since I have a view push/dismiss calls, I want to make sure I don't have any views in my stack that I wouldn't expect. Is it possible to see this in the Xcode debugger?

推荐答案

您可能会发现lldb使用'recursiveDescription'来解决问题。只需在您对视图层次结构感兴趣的位置设置断点。例如,如果你想要窗口中的所有内容,你可以输入

You might find lldb comes to the rescue with 'recursiveDescription'. Simply set a breakpoint at the point where you are interested in the view hierarchy. If for example you want everything in the window you can type

(lldb) po [[[[UIApplication sharedApplication] windows] firstObject] recursiveDescription]

或者,我经常发现在调试视图时我最感兴趣的是层次结构特别的观点。在这种情况下,您可以直接挂接到您感兴趣的代码中的点(例如viewDidAppear:方法)并输入:

Alternatively, I often find that when debugging views I am mostly interested in the hierarchy for a particular view. In that instance you can hook straight in to the point in code you are curious about (for example the viewDidAppear: method) and type:

(lldb) po [self.view recursiveDescription]

注意:使用Xcode 6 Apple增加了实时视图调试,您可以从调试栏访问它。

Note: With Xcode 6 Apple have added realtime view debugging which you can access from the debug bar.

这篇关于在Xcode中调试时,我可以在应用程序中看到我的视图层次结构吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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