导航栏项目从导航栏中消失
一段时间以来,我一直在努力解决导航栏项目的奇怪行为。我在导航栏上进行了分段控制(请看下图)
其中 List 按钮使用 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 处于活动状态时,所有项都会从导航栏中消失
有人知道为什么吗它发生了吗? 提前致谢。
I have been struggling for some time with the strange behavior of navigation bar items. I have segmented control on the navigation bar (take a look at the image below)
where List button pushes table view controller with UISearchDisplayController. To show table view controller I use the code as it follows:
if (uiSegmentedControl.selectedSegmentIndex == 1 )
{
DetailsTableVewController* detailsViewController = [[DetailsTableVewController alloc]
initWithList:list];
[self.navigationController pushViewController:detailsViewController animated:YES];
[detailsViewController release];
}
Then to return back I use the following code:
[self.navigationController popViewControllerAnimated:YES];
Although I use the code above to go back to the previous controller when UISearchDisplayController is either active or inactive I have different behavior of the navigation bar items. When UISearchDisplayController is active ALL items disappear from the navigation bar
Does anybody know why it happens?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将所有导航栏初始化代码从控制器中的
viewDidLoad
移动到viewWillAppear
并解决了问题Moved all navbar initialization code from
viewDidLoad
toviewWillAppear
in controller and it solved the problem