Cezar Alexandru Vancea
Cezar Alexandru Vancea

Reputation: 578

Iphone dismissModalViewController animation

How can I modify the animation for dismiss?

for present, I've used :

SlideShow *slider = [[SlideShow alloc] initWithNibName:@"SlideShow" bundle:nil];
slider.view.alpha = 0.0;
[self presentModalViewController: slider animated: NO];

[UIView beginAnimations: nil context: nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];

slider.view.alpha = 1.0;
[UIView commitAnimations];

and it works..

But how about a way to dismiss it using a custom animation (I was looking for a Fade-Out animation for dismiss)

Thanks.

Upvotes: 2

Views: 930

Answers (2)

Mike A
Mike A

Reputation: 2529

presentModalViewController is essentially a method that serves up a pre-baked animation for your viewController.view. If you want to make a custom animation for dismissing or presenting a modal view, you have to handle it all on your own.

Upvotes: 1

Bjarne Mogstad
Bjarne Mogstad

Reputation: 1154

You are fading view controllers the old school way, since iOS 3 the easiest and best way to fade a view controller is to set its property: (ex. in the init method)

self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

Your view controller will then fade nicely in and out.

Upvotes: 1

Related Questions