2009-11-12 142 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斷開我的導航控制器並以編程方式創建它們而得到了這個工作。