Ben Scheirman

Menu

Firebug-Style Visual Debugging for iOS

Using a crazy helpful library called DC Introspect you’re able to easily take an app running in the Simulator:

And get visual frame debugging information like this:

You can also click & drag your mouse to get pixel information, surrounding frames, print out detailed frame information in the console, and even move frames around all while the app is running.

Using it is incredibly simple:

  • Make sure you have DEBUG defined in your Preprocessor Macros:

1
    #import "DCIntrospect.h"
1
2
3
4
5
6
7
// in applicationDidFinishLaunching:

[self.window makeKeyAndVisible];

#ifdef TARGET_IPHONE_SIMULATOR
    [[DCIntrospect sharedIntrospector] start];
#endif

Once that is done, the library will be loaded and you can use it. When the simulator launches, just press Spacebar to activate the tool.

Here are some keyboard shortcuts:

  • o – Outline all views
  • ? – Prints out a help view
  • f – Flash on drawRect: calls
  • c – Toggle showing coordinates
  • 4 6 8 2 – Nudge the selected view left, right, up, down
  • 0 – Recenter view where it was originally
  • 9 7 3 1 – Modify Width & Height of selected view

You can also click & drag with the mouse to get detailed information about frames & mouse position.

I am amazed at how awesome this library is. I’ll be using it in my default toolbox from now on.

Comments