how to find out which UIVIews are on the screen at runtime-Collection of common programming errors

I am working on an iPhone app that has a complex way of constructing its views, I am at a point where some of the UI behavior is not consistent and some UI views are not being presented properly, without going into a lot of details, I am looking for a way at runtime to find out each and every UI element on the screen, and its location and whatever information I can get about it ( the UI stack, the layering, which UIVIew is on top of what ) is that available to developers/

Thanks.

  1. In debug console, send recursiveDescription message to your topmost view.

    (lldb) po [self.view recursiveDescription]
    (id) $1 = 0x0929f000 
       | 
       |    | 
       |    | 
    (lldb) 
    
  2. I’m the author of a tool called the Spark Inspector that allows you to view and interact with your app’s UIViews while it’s running. I put it together because I found myself using -recursiveDescription all the time and pouring over the console output was annoying-I think it’s probably just what you need. Instead of calling -recursiveDescription, you add a framework to your app that lets the inspector tool connect and show you your views.

    There are two other tools I’d recommend checking out as well: PonyDebugger and DCIntrospect. They take a bit more setup, but they’re both lifesavers if you find yourself needing to debug views.