开发者

What is the closest utility to Snoop for iPhone/iPad development?

Is there anything remotely close to the WPF Snoop utility for iPhone/iOS development?

I have found Mike Ash's ObjC wrapper, however this seems more helpful for reflection than for analyzing the instance state of UIKit hierarchies.

An example of where this is useful: I integrated a split-view inside of a tabbar view and it's not quite working. Yes there are some bits of code out there for this to just "make it work". However I want to get dirty and fix my own problems to better master the platform.

The most obvious i开发者_JS百科mplementations seem to be to pass in a root viewcontroller instance to a utility class method.

The utility could then output the UIKit hierarchy in the debug window, or to get fancy, popup a modal view that lets you graphically browse the state like Snoop.


If you want to get your hands dirty, just leverage objective-C's dynamic behavior, and implement it yourself. You could create a category on UIView with a recursive method that prints out info about its children. Then in GDB just call it on the window (since window is a subclass of UIView. Something like:

@interface UIView ( DebugExras )
    - (void)debugPrintViewTree;
@end

And in GDB:

gdb: po [[[UIApplication sharedApplication] keyWindow] debugPrintViewTree]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜