开发者

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开发者_如何学Go a way to dismiss it using a custom animation (I was looking for a Fade-Out animation for dismiss)

Thanks.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜