[ios]打印ViewTree 链接

http://poolo.iteye.com/blog/1833821

    - (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]];  
        for (UIView *view in [aView subviews])  
            [self dumpView:view atIndent:indent + 1 into:outstring];  
    }  
      
    // Start the tree recursion at level 0 with the root view  
    - (NSString *) displayViews: (UIView *) aView  
    {  
        NSMutableString *outstring = [[NSMutableString alloc] init];  
        [self dumpView: self.window atIndent:0 into:outstring];  
        return outstring ;  
    }  
    // Show the tree  
    - (void)logViewTreeForMainWindow  
    {  
        //  CFShow([self displayViews: self.window]);  
        NSLog(@"The view tree:\n%@", [self displayViews:self.window]);  
    }  

Android 终于知道Log显示不全的原因了

 

posted @ 2014-09-28 15:15  米粥米  阅读(127)  评论(0编辑  收藏  举报