March 2008
Intermediate to advanced
288 pages
6h 21m
English
In the absence of a fully functional debugger for the iPhone, one aid to developers is the _dumpUIHierarchy method provided by the UIApplication class. A UI dump shows the associations of all display UI objects to each other in a parent/child type of hierarchy. For example, a navigation bar may appear like this in the dump:
<dict>
<key>CGRect</key>
<data>
AAAAAAAAoEEAAKBDAABAQg==
</data>
<key>Children</key>
<array>
<dict>
<key>CGRect</key>
<data>
AAAAAAAAoEEAAAAAAAAAAA==
</data>
<key>Enabled</key>
<false/>
<key>ID</key>
<string><UINavigationItemView: 0x22fe60></string>
</dict>
<dict>
<key>CGRect</key>
<data>
AAB3QwAA+EEAAIhCAADwQQ==
</data>
<key>Enabled</key>
<true/>
<key>ID</key>
<string>BTN Settings</string>
</dict>
</array>
<key>Enabled</key>
<true/>
<key>ID</key>
<string><UINavigationBar: 0x22f380></string>
</dict>
To invoke a dump, call the UIApplication class's _dumpUIHierarchy instance method:
[ self _dumpUIHierarchy: nil ];
An XML-formatted file will be written to /tmp/UIDump. All windowed objects are written to the dump in the hierarchy in which they are currently allocated.
Read now
Unlock full access