0

I've seen this effect on numerous apps, including the YouTube, Fandango, the iPod movie player, Netflix app, the list goes on and on... They are displaying navigation controller UI, and you choose to play a movie (from a button on the current view controller), and then the nav bar as well as the view controller both slide down off the screen in unison, then the video player is revealed.

The only way I know how to acheive this effect is if the current view controller (with the play button) was loaded via presentModalViewController, then calling dismissModalViewControllerAnimated:YES will do the trick. However, the above are not doing this, as I can clearly see the current view controller sliding in from the right, which is typical behavior resulting from a call to pushViewController from the navigation controller.

Any ideas?

bpatrick100
  • 1,261
  • 1
  • 15
  • 23

1 Answers1

1

For starters, you may have to call [self presentModalViewController:moviePlayerViewController animated:YES] on the top-most controller. In your case, that would be the navigation controller. E.g.

// initialize moviePlayerViewController
[self.navigationController
  presentModalViewController:moviePlayerViewController
                    animated:YES];

But this solution only fades the movie controller in, it does not slide the navigation controller's view out of the way. For that, you will have to animate the view in the desired way. I recommend the following solution:

Custom Animation for Pushing a UIViewController

After your animation is completed, you display the movie player controller.

Community
  • 1
  • 1
Dimitry
  • 6,545
  • 2
  • 20
  • 21
  • I've tried all the animations, and though many of them look nice, they're not acheiving my goal which I described in my original question. I understand you can slide up/down objects on the screen, but I don't understand how to do this with the entire UIViewController - I can't get it to slide down (both the UINavigationBar and UIViewController) - There has to be a way, I listed several apps that do this... – bpatrick100 Mar 06 '11 at 18:17
  • Isn't there something you can do with the bounds property of your navigation controller. Have you tried moving the bounds from 0 to frame.size.height of that view? – Dimitry Mar 06 '11 at 18:35
  • Ahh - you are exactly right. Thanks very much! I was able to change: self.navigationController.view.bounds.origin.y within in animation block to get it to slide down and disappear. Thanks again :-) – bpatrick100 Mar 06 '11 at 20:08