Reputation: 303
I am working on a dense iPhone app that has multiple UIViews, some funky things happen in it and a lot of views are added to subviews and so forth.
For debugging purposes I put breakpoints where I think its relevant and then po objects (ie :
po [ [ self.view superview ] subviews ] ) Now this command does give me some information but it doesn't tell me the name of the UIView ( name given to it by the designer ) it would tell me that its a UIView or UIImageView.
thought I would ask if anyone knows any good commands I can use with the debugger at runtime to get more insightful info.
I know po [self.view recursiveDescription] too BTW.
Thanks.
Upvotes: 2
Views: 97
Reputation: 438232
When you say "name given to it by the designer", are you talking about the Objective-C variable name? I don't know of any way to do that.
You obviously can set the controls' numeric tag
property (which you can set both via IB as well as via code for those programmatically created controls). The NSLog
statements and debugger show the tag
property. So you can identify the views that way. It's just not very user-friendly. If you want to see text names, though, you'd probably have to build your own mapping between numeric tags and descriptive names that mean something to you, and then write your own method to iterate through the views, deciphering tags were it can, to show something more meaningful.
Seems like you might also be able to do something with user-defined runtime attributes, but I also bet that would be a lot of subclassing, too.
Upvotes: 1