Xcode debugging - displaying images Xcode debugging - displaying images xcode xcode

Xcode debugging - displaying images


Use Quick Look to inspect images in the Xcode debugger.

Select an NSImage or UIImage in the debugger, then click the Quick Look "eye" icon.

"eye" icon in Xcode debugger toolbar

Like other areas of OS X, you can also use spacebar to Quick Look!

Viewing a UIImage in the Xcode debugger via Quick Look

Quick Look in the debugger can also be implemented for your own classes:

Enabling Quick Look for Custom Types

The variables Quick Look feature in the Xcode debugger allows you to obtain a quick visual assessment of the state of an object variable through a graphical rendering, displayed in a popover window either in the debugger variables view or in place in your source code.

This chapter describes how you implement a Quick Look method for your custom class types so that object variables of those types can also be rendered visually in the Quick Look popover window.


If you like to work with the lldb console, use chisel command "visualize"

tip:

after the installation, you can set a conditional breakpoint after setting the UIImage with the action: "visualize myUIImageToShowWithQuickLook"

enter image description here

this will show you the image automatically when the debugger stops.


EDIT:

As of Xcode 5, the debugger can show you the visual representation of UIImage/CGImageRef variables!

Xcode itself can't do it. I don't know about external tools.

What i'm doing to test images while debugging is to convert that raw data into an image-file format, like .png, and then saving it somewhere, and then i'm opening the image with any image viewing tool.

I have a piece of code for that purpose, which look basically like that:

NSData *imageData = UIImagePNGRepresentation(self.myUIImage);[imageData writeToURL:desktopURL atomically:YES];

And i'm just copy-pasting this code where i want to see content of an image on the run.

Make sure to get rid of this code as soon as possible due to the high-cost of the conversion of UIImage to NSData