2009-11-12 172 views
3

我有一个UITabBarController的标签是UINavigationController。我已经初始化每个navigationController:popToRootViewControllerAnimated工具栏没有正确更新

iPhoneApp *appDelegate = (iPhoneApp *)[[UIApplication sharedApplication] delegate]; 
[appDelegate.navigationController2 initWithRootViewController:countryController]; 

然后我钻到navigationController有:

[self.navigationController pushViewController:myViewController animated:YES]; 

我想弹出我的navigationController(S)的根,当用户点击一个的TabBar标签。

[delegate.navigationController2 popToRootViewControllerAnimated:NO]; 

这似乎是工作伟大的,当我只pushViewController一个级别,但没有当我在navigationController向下钻取多个级别。什么情况是,它会弹出根除,但不包含我的根的后退按钮或标题:

self.navigationItem.title = @"My title"; 
self.navigationItem.hidesBackButton = YES; 

UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" 
                 style:UIBarButtonItemStyleDone 
                 target:self 
                action:@selector(handleBack:)]; 

,如果我不poptoroot,只是使用navigationControlls后退按钮,一切工作正常。

我之前和之后我poptoroot

登录我viewControllers

前: MainCountryController:0x3d53650, IndividualCountryMfgViewController:0x3d67d50, IndividualCountryProductViewController:0x3d60870

后: MainCountryController:0x3d53650

这是正确的查看,但错误的工具栏标题和后退按钮。

任何人有任何想法?谢谢你的帮助。

回答

1

我通过从IB断开我的导航控制器并以编程方式创建它们而得到了这个工作。