1

I have an application where I'm trying to duplicate what I see the Apple Store app doing, where the first view doesn't have a navigation bar, but subsequent views do.

I've tried various combinations of setting navigationBarHidden to YES and NO to manage when it's visible, but the key problem seems to be that during the transition, it's either visible or it isn't, whereas in the Apple Store app, the navigation bar is not there in the main view, but slides in from the right with the child view.

What I'm looking for is a way to have the navigation bar slide in with the child view, not appear (animated or not) before or after the transition.

nsinvocation
  • 7,559
  • 3
  • 41
  • 46
stevex
  • 5,589
  • 37
  • 52

3 Answers3

1

Turns out I just hadn't hit on the right places to hide and show the navigation bar.

I used the answer from how to hide navigationbar when i push from navigation controller? and it works great for me now.

Community
  • 1
  • 1
stevex
  • 5,589
  • 37
  • 52
0

in your main view, initialize the childViewController. Then set the nav bar on the childViewController, the push the view controller.

ChildVC *childVC = [[ChildVC alloc] initWithNibName:@"ChildVC" bundle:nil];
[self setChildVC:childVC];
childVC.navigationController.navigationBarHidden = NO;
[self.navigationController pushViewController:childVC animated:YES];
bkbeachlabs
  • 2,121
  • 1
  • 22
  • 33
  • What this does for me is makes the navigation controller appear instantly instead of sliding in. – stevex Jul 07 '12 at 20:53
0

If you are talking about what they do on the first Tab "Featured", where if you tap one of the items in the list with a disclosure indicator. It appears to slides in another view from right to left. I think they are using an animation to swap two view controllers. The one that slides in IS a Navigation controller which is why NavBar appears to slide in from the right.

You would do something like this to get that effect:

// First set up a view controller with frame set off to the right of the screen.
// Then animate it sliding to the left by setting its frame x = 0;

frame.origin.x = 0;
[UIView animateWithDuration:.4 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut
    animations:^{
        vc.view.frame = frame;
    }
    completion:nil];
Cliff Ribaudo
  • 8,932
  • 2
  • 55
  • 78