ios,递归打印一个view的子view

 方法一:

- (void)dumpView:(UIView *)aView atIndent:(int)indent into:(NSMutableString *)outstring

{

    for (int i = 0; i < indent; i++) [outstring appendString:@"--"];

    {

        [outstring appendFormat:@"[%2d] %@\n", indent, [[aView class] description]];

        

        if ([[[aView class] description] isEqualToString:@"MPVideoView"]) {

            foundedTapParentView = aView;

        }

        

        for (UIView *view in [aView subviews])

        {

            [self dumpView:view atIndent:indent + 1 into:outstring];

        }

 

    }

}

 

- (NSString *) displayViews: (UIView *) aView

{

    NSMutableString *outstring = [[NSMutableStringalloc] init];

    [self dumpView:aView atIndent:0 into:outstring];

    return outstring ;

}

 

 

方法二:

po [_myToolbar recursiveDescription]
posted @ 2014-04-01 11:45  jianfei00  阅读(432)  评论(0编辑  收藏  举报