TabBarController 显示/隐藏第一级页面的TabBar以及从push栈中获取viewcontroller

来源:互联网 发布:淘宝网儿童背包 编辑:程序博客网 时间:2024/06/06 07:12

- (void)setTabBarHidden:(BOOL)hidden{    UIView *tab = self.tabBarController.view;        if ([tab.subviews count] < 2) {        return;    }    UIView *view;        if ([[tab.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]]) {        view = [tab.subviews objectAtIndex:1];    } else {        view = [tab.subviews objectAtIndex:0];    }        if (hidden) {        view.frame = tab.bounds;    } else {        view.frame = CGRectMake(tab.bounds.origin.x, tab.bounds.origin.y, tab.bounds.size.width, tab.bounds.size.height);    }    self.view.frame = view.frame;    self.tabBarController.tabBar.hidden = hidden;}

for(UIViewController *controllerin self.navigationController.viewControllers) {

            NSString *className =NSStringFromClass([controller class]);

            NSLog(@"--className--%@",className);

            if([controllerisKindOfClass:[CategoriesViewControllerclass]]){

                CategoriesViewController *viewCon = (CategoriesViewController *)controller;

                [self.navigationControllerpopToViewController:viewCon animated:YES];

            }

       }

0 0
原创粉丝点击