0

I have a native iOS app that will have some native content and some content surfaced in UIWebViews. Overall my navigation is done with a UINavigation Controller, but once I get into the 2nd level of the web app I want to switch to the Web navigation, and I want this to appear seamless to the user.

I have found a way to hide the uinavigationcontroller when I in the 2nd view, using the following code:

    NSURL *url = request.URL;
      NSString *urlString = [url absoluteString];

      if ([urlString isEqualToString:@"http:myApp/Page1.xsp"]) 
      {
        [self.navigationController setNavigationBarHidden:FALSE animated:YES];
      } else {
        [self.navigationController setNavigationBarHidden:TRUE animated:YES];
      }

      return YES;
    }

However, when I run this I see the iOS UINavigationBar and then it moves up to the top of the screen and is hidden. This is not a good user experience.

I want to hide the navigation bar and then load the page, but cannot figure out how to do that.

Bryan Schmiedeler
  • 2,977
  • 6
  • 35
  • 74

1 Answers1

0

You need to call that same method on the viewWillAppear: of the appearing controller, that'll get you the result you need

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

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
Fernando Mazzon
  • 3,562
  • 1
  • 19
  • 21