UITabBarController 的 View 的子视图信息

- (void)viewDidAppear:(BOOL)animated{  

[super viewDidAppear:animated];  

[self printViewHierarchy:self.tabBarController.view];

}


- (void)printViewHierarchy:(UIView *)superView
{
    static uint level = 0;
    for(uint i = 0; i < level; i++){
        printf("\t");
    }

    const char *className = NSStringFromClass([superView class]).UTF8String;
    const char *frame = NSStringFromCGRect(superView.frame).UTF8String;
    printf("%s:%s\n", className, frame);

    ++level;
    for(UIView *view in superView.subviews){
        [self printViewHierarchy:view];
    }
    --level;
}

  
  
  
  
结果如下:

UILayoutContainerView:{{0, 0}, {320, 480}}

UITransitionView:{{0, 0}, {320, 431}}

UITabBar:{{0, 431}, {320, 49}}

_UITabBarBackgroundView:{{0, 0}, {320, 480}}

UIImageView:{{0, -3}, {320, 3}}


你可能感兴趣的:(UITabBarController 的 View 的子视图信息)