踊る犬.netブログ (旧)

[XCode] LLDBでViewの階層構造を出力する

これは知っておいて損は無いTips。

po [UIView recursiveDescription] で、包含するViewを階層構造も含めて出力させる事ができます。

(lldb) po [self.view.superview recursiveDescription]
<uiviewcontrollerwrapperview: 0xbe5a870; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0xbe5a940>>
   | <uiview: 0xbe0cb10; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0xbe51d70>>
   |    | <uibutton: 0xb819e90; frame = (20 60; 100 44); opaque = NO; layer = <CALayer: 0xb819690>>
   |    |    | <uibuttonlabel: 0xbe5e200; frame = (27 13; 46 18); text = 'Button'; clipsToBounds = YES; alpha = 0.2; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xbe5dfb0>>
   |    | <uibutton: 0xb81ed00; frame = (20 120; 100 44); opaque = NO; layer = <CALayer: 0xb81edf0>>
   |    |    | <uibuttonlabel: 0xbe5c760; frame = (24 13; 52 18); text = 'Sample'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xbe5c870>>