2011-04-30 252 views
0

我一直在用导航栏物品的奇怪行为挣扎一段时间。我已分段导航栏上的控制(看看下面的图像)导航栏中的物品从导航栏中消失

enter image description here

其中列表按钮按压与UISearchDisplayController表视图控制器。为了显示表视图控制器我使用的代码,因为它遵循:

if (uiSegmentedControl.selectedSegmentIndex == 1) 
{ 
    DetailsTableVewController* detailsViewController = [[DetailsTableVewController alloc] 
                 initWithList:list]; 
    [self.navigationController pushViewController:detailsViewController animated:YES]; 
    [detailsViewController release]; 
}  

然后返回后,我用下面的代码:

[self.navigationController popViewControllerAnimated:YES]; 

虽然我用上面的代码返回到前一个控制器当UISearchDisplayController处于活动状态或非活动状态时,导航栏项目的行为不同。当UISearchDisplayController活跃ALL项目从导航栏消失

enter image description here

是否有人知道为什么会发生? 在此先感谢。

回答

1

将控制器中的所有导航条初始化代码从viewDidLoad移至viewWillAppear并解决了问题