在BC TabBar中删除导航栏

时间:2012-10-24 08:00:36

标签: iphone ios uitabbarcontroller

我试图使用像BCTabBar这样的动画制作CustomTabBar

我在AppDelegate中编写了这段代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.   tabBarController.delegate = self;
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.tabBarController = [[BCTabBarController alloc] init];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:[[UINavigationController alloc]
                                                                       initWithRootViewController:[[ProfileViewController alloc] init]],  [[ChargeViewController alloc] init],
                                             [[OffersViewController alloc] init],
                                             [[ContactUsViewController alloc] init],
                                             nil,nil];

    [self.window addSubview:self.tabBarController.view];
    [self.window makeKeyAndVisible];
    return YES;

}

并且工作正常但是我想在RootViewController中删除NavigationBar我能做什么?

2 个答案:

答案 0 :(得分:0)

你不能隐藏Tabbar吗?

- (void)hideTabBar:(BCTabBarController *) tabbarcontroller
{
    for(UIView *view in tabbarcontroller.view.subviews)
    {
        if([view isKindOfClass:[BCTabBarController class]])
        {
            [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
        } 
        else 
        {
            [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
        }
    }
}

答案 1 :(得分:0)

ProfileViewController班级中写[[self navigationController] setNavigationBarHidden:YES animated:NO];。这应该隐藏导航栏。如果您需要在其他地方展示它,可以再次将其设置为[[self navigationController] setNavigationBarHidden:NO animated:NO];