2012-11-09 3 views
1

내 응용 프로그램에 UITabBarController를 구현했습니다. 다음과 같이의 코드는 다음과 같습니다iPhone에서 UITabbarController를 숨기는 방법

MainCollection *mainView = [[MainCollection alloc] initWithNibName:@"MainCollection" bundle:nil]; 
    UINavigationController *mainNav = [[UINavigationController alloc] initWithRootViewController:mainView]; 

    mainView = (MainCollection *)mainNav.topViewController; 
    mainView.managedObjectContext = self.managedObjectContext; 

    ShowFavourites *showVC = [[ShowFavourites alloc] initWithNibName:@"ShowFavourites" bundle:nil]; 
    UINavigationController *showNav = [[UINavigationController alloc] initWithRootViewController:showVC]; 
    [email protected]"Favourites"; 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    UITabBarController *tabBar = [[UITabBarController alloc] init]; 

    [tabBar setViewControllers:@[mainNav,showNav]]; 

    [self.window setRootViewController:tabBar]; 

    [self.window makeKeyAndVisible]; 


    return YES; 

내 첫 화면 내가이보기에서 한 tabBar을 표시해야합니다 MainCollection입니다. 다음보기가 인 경우 하위 범주이지만 하위 범주로 이동하면이보기에서 Tabbar를 숨기려고합니다. 어떻게 숨기거나 제거 할 수 있습니까? 하위 범주보기?

아이디어가 있으십니까?

미리 감사드립니다.

+0

이 혼란 질문을 구체적으로 설명해주십시오이다. – Raj

+0

@Raj : plz 내 편집 된 답변 확인 – iPhone

답변

5

매우 간단한 해결책이 있습니다. 당신은 더 열심히 노력해야했습니다. 보기에서 이있는 당신은 단순히 여기

self.hidesBottomBarWhenPushed = YES; 

를 추가 SO 자체에 대한 이러한 링크에 액세스 UITabBar을 숨기려. 당신은 쉽게 답을 찾을 수 있습니다 : -

Show/Hide TabBarController in iphone

How to hide uitabbarcontroller

How to Hide Tab Bar Controller?

Is it possible to hide the tabbar when a button is pressed to allow a full screen view of the content?

How to hide UITabBarController programmatically?

How to hide an iPhone Tab Bar?

3

TabBar의 바로 하위 화면으로 추진하기위한

[self.tabBarController.navigationController pushViewController:subCategoryObj animated:YES]; 

감사를 부모 네비게이션 컨트롤러를 사용 숨길 필요가 없습니다,

+0

푸시 된보기 컨트롤러에서 'self.title'을 설정할 때 탐색 컨트롤러를 업데이트하지 않기 때문에 이는 권장하지 않습니다. 다른 대답은 훨씬 낫다. – vaughan

관련 문제