iOS: 查看 UIView 的视图树
在想要查看的 UIView 附近打个断点,运行,直到停在断点处,在控制台键入:po [view recursiveDescription],回车。
(lldb) po [self recursiveDescription] <BPSearchBar: 0xaab5fe0; baseClass = UISearchBar; frame = (114 0; 500 44); text = ''; opaque = NO; autoresize = LM+RM+TM; gestureRecognizers = <NSArray: 0xaab7c80>; layer = <CALayer: 0xaab6210>> | <UIView: 0xaab7470; frame = (0 0; 500 44); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xaab74d0>> | | <UISearchBarBackground: 0xaab7f90; frame = (0 0; 500 44); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xaab80e0>> | | <UISearchBarTextField: 0xaab8bf0; frame = (8 8; 484 28); text = ''; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0xb9c4a30>; layer = <CALayer: 0xaab8d80>> | | | <UITextFieldBorderView: 0xb9d37e0; frame = (0 0; 484 28); opaque = NO; layer = <CALayer: 0xb9d38f0>> | | | <UIImageView: 0xaabb4c0; frame = (232 7.5; 12.5 12.5); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xaabb0e0>> (lldb)