English 中文(简体)
如何在表格视图搜索栏中引用导航控制器?
原标题:How to get reference to navigationcontroller in tableview searchbar?

I have setup in storyboard a navigation controller and a tableview controller. There is a search bar in the tableview. I get a reference to the navigation controller using self.navigationcontroller. I use

[self.navigationController setNavigationBarHidden:YES animated:animated];

To hide the navigation bar in the subsequent view which is displayed. This works fine when selecting a cell in the tableview without using the searchbar. However, if I use the searchbar to display specific cells in the table view and if I select a cell from that table, then apparently I lose the reference to the navigation controller because although the above code is executed, the navigation bar is still displayed in the follwing view.

我该怎么把导航器藏起来?

最佳回答

这就是我发现的东西:导航BarHidden 属性显然被重置,因为当搜索栏离开视图时,它会再次发送导航栏到视图上。我不知道我是否确切理解正在发生的事情,但我认为这行代码会消失,解决了问题:

 self.searchDisplayController.active=NO;
问题回答

为什么你不对以下的查看控制器 执行那条代码线?

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签