/ Published in: Objective C
This is adapted from Erica Sadun's explode code in her book "iPhone Developer's Cookbook".
It takes any UIView-based element and exposes all of the subviews and their subviews, etc.
Its a good way to dig into UIKit elements as well as debug your own UIView-based code.
In code, always set level to zero.
It takes any UIView-based element and exposes all of the subviews and their subviews, etc.
Its a good way to dig into UIKit elements as well as debug your own UIView-based code.
In code, always set level to zero.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#define objectString(anObject) [[anObject description] UTF8String] #import <Foundation/Foundation.h> + (void)explode:(id)viewObj level:(int)level; @end @implementation Util + (void)explode:(id)viewObj level:(int)level { // indent to show the current level for (int i = 0; i < level; i++) { } // show the class and superclass for the current object id obj = [viewObj superclass]; while (NULL != obj) { obj = [obj superclass]; } // recurse for all subviews for (UIView *sub in [viewObj subviews]) { [Util explode:sub level:(level + 1)]; } } @end