inspect the view hierarchy in iOS
Sometimes you need to see all subviews in the current screen or view.
If you pause the app in the debugger and input this into console:
po [[UIWindow keyWindow] recursiveDescription]
You get a printout of your entire view hierarchy. You can also call it on a specific view to get a printout of the view hierarchy of that view.
Also you can add alias to .lldbinit like this:
command alias pwin expression -o -- (NSString *)[[UIWindow keyWindow] recursiveDescription]
After that you get the same result only with pwin command in console
Save you time ;)
Written by hash3r
Related protips
1 Response
Ahh man I had no idea you could alias commands in LLDB like that - that's awesome. That could save tons of time!
By the way—if you find yourself using recursiveDescription a lot you should check out the Spark Inspector. We built it over at Foundry376 to use in-house but we just published it at http://www.sparkinspector.com/. Basically like having a real-time recursiveDescription on steroids :-)