0

I have stocked in a confusing situation. I'm using a Navigation Controller and UIPageViewController.

first we have a view contains a TableView with searchDisplayController. this table view shows a list of story. you can select a cell and go to another view(page based view) and read the story. so in the second view I have hidden the navigation bar. because the reader wants to curl the pages.

here every thing works well until I search for a word in searchBar (first view) and after selecting the cell, and going to the second view the navigation bar won't hide!

both view has inherited from UIViewController.

and in the second view, I did this:

- (void)viewWillAppear:(BOOL)animated
{
  [super viewWillAppear:animated];

  [self.navigationController setNavigationBarHidden:YES animated:animated];
    if (self.navigationController.navigationBarHidden) {
        NSLog(@"navigation bar is hidden");
    }

}

even I explicitly hide the navigation Bar, when it reaches the If statement, it appears the navigation bar is not hidden.

what am I doing wrong?

Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75

3 Answers3

0

Dont hide navigation bar.Just decrease its alpha.

self.navigationController.navigationBar.alpha =0;
Desert Rose
  • 3,376
  • 1
  • 30
  • 36
  • i did that. it works, but makes the problem complicated. and while curling the pages, navigation bar appears again or sometimes appear. I wanted to know why when I explicitly hiding it, it doesn't disappear. and (if statement) shows it hasn't disappeared? – Hashem Aboonajmi Jun 15 '13 at 13:27
0

In the appDelegate.m do this

[self.navigationController setNavigationBarHidden:YES];  

after alloc initiating the UINavigation controller and before adding it to window.

0

i found the answer here:

https://stackoverflow.com/a/6337037/1348121

UISearch display controller has a built in Navigation Bar and we must hack it in some way to disable it.

Community
  • 1
  • 1
Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75