Iphone – How to change the animation style of a modal UIViewController

cocoa-touchiphone

I'm currently displaying a UIViewController like this:

[[self navigationController] presentModalViewController:modalViewController animated:YES];

and hiding it like this:

[self.navigationController dismissModalViewControllerAnimated:YES];

The animation is "slide up from the bottom"… then slide back down. How can I change the animation style? Can I made it fade in/out?

Cheers!

Best Answer

For iPhone 3.0+, a basic crossfade is easiest to do like this:

modalViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[[self navigationController] presentModalViewController:modalViewController
                                               animated:YES];