rootviewController (UInavigation 컨트롤러)에서 새로운 StatusViewController (프로그래밍 방식으로 만든 UITabbarViewController)를 푸시합니다. 자, 로그 아웃 버튼을 클릭하고 싶습니다. rootviewcontroller를 밀었지만 코드 아래에서 사용했습니다. rootviewcontroller는 괜찮지 만 하단에는 여전히 tabbar가 있습니다.Ios에서 rootviewcontroller를 푸시하는 방법
이 코드는 rootviewcontroller 호출 :
LoginTab *loginView = [[LoginTab alloc] init];
[self.navigationController pushViewController:loginView animated:YES];
[loginView release];
그리고이 코드는 StatusViewController에서 UITabBarController가 만들어집니다 :
self.tab=[[UITabBarController alloc]init];
UploadTab *uploadview=[[UploadTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *uploadTabItem = [[[UINavigationController alloc] initWithRootViewController: uploadview] autorelease];
[email protected]"Uploading";
uploadview.tabBarItem.image=[UIImage imageNamed:@"Uploading.png"];
self.title = @"FirstViewControllerTitle";
//SecondViewController
ConvertTab *convertView=[[ConvertTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *convertTabItem = [[[UINavigationController alloc] initWithRootViewController: convertView] autorelease];
[email protected]"Convert";
convertView.tabBarItem.image=[UIImage imageNamed:@"Convert.png"];
//ThirdViewController
CompletedTab *completedView=[[CompletedTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *completedTabItem = [[[UINavigationController alloc] initWithRootViewController: completedView] autorelease];
[email protected]"Completed";
completedView.tabBarItem.image=[UIImage imageNamed:@"Completed.png"];
UIBarButtonItem * LogoutItem= [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Logout.png"] style:UIBarButtonItemStylePlain target:self action:@selector(logout)];
self.navigationItem.rightBarButtonItem = LogoutItem;
self.tab.viewControllers=[NSArray arrayWithObjects:uploadTabItem,convertTabItem, completedTabItem, nil];
// [self.view insertSubview:self.tab.view belowSubview: uploadview.view];
[self presentModalViewController:self.tab animated:NO];
당신은이 이미지를 볼 수 있습니다
루트로 푸시하지 않으려면 루트로 POP를 바꿔야합니다. – Stavash