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]
浙公网安备 33010602011771号