나는 아이폰 응용 프로그램이있는 tabbarcontroller.Inside tabbarcontroller 함께 각 viewcontroller 네비게이션 controller.when 두 번째 탭을 내가보기 controller.when 다른 버튼을 선택하고 다른보기 컨트롤러 self.navigation controller.and viewcontroller 나는 pushing하고 그렇게 가고있다. 그러나 문제는 내가 pushedviewcotrooller가 거기에 보여지는 tabitem을 다시 선택할 때이다. 그러나 내가 그 탭을 선택할 때 다시 rootview가 필요하다. 난 내 코드에서 다음과 같이 시도했지만되지는 탭을 선택할 때마다 내 루트보기를로드하는 방법은 무엇입니까?
-(void)tabBarController:(UITabBarController *)tabbBarController didSelectViewController:(UIViewController *)viewController
{
if(tabBarController.selectedIndex==0)
{
//[viewController.tabBarItem setImage:[UIImage imageNamed:@"pinboard_hvr.png"]];
}
else if (tabBarController.selectedIndex==1)
{
NSLog(@"%@",viewController);
//[viewController.tabBarItem setImage:[UIImage imageNamed:@"pinboard_hvr.png"]];
// NSArray *array = [viewController.navigationController viewControllers];
NSLog(@"%@",array);
// [self.navigationController popToViewController:[array objectAtIndex:0] animated:YES];
[viewController.navigationController popToRootViewControllerAnimated:YES];
//[appdelegate.navigationController popToRootViewControllerAnimated:YES];
}
else if (tabBarController.selectedIndex==2)
{
//[viewController.tabBarItem setImage:[UIImage imageNamed:@"pinboard_hvr.png"]];
}
}
이`내가보기 컨트롤러의 배열을 복용하여도 뿌리 저런 애과 함께 모두 시도`, 일, 그러나 누군가가 나에게 이것을 달성하는 데 도움이 worked.Can하지?
+1 답변 – hacker