Xcode debugging - displaying images

前端 未结 7 891
臣服心动
臣服心动 2020-12-07 15:04

I love using the Xcode debugger. You can take a look at a variable\'s value and even change it.

But can I somehow DISPLAY the image that is referenced by an image va

7条回答
  •  感动是毒
    2020-12-07 15:47

    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

提交回复
热议问题