Reputation: 27
I have a bit of code that i use to transition between views.
if (CGRectIntersectsRect(mainSprite.frame, backTopPathImg.frame)) {
levelOneViewController * levelOne2 = [[levelOneViewController alloc]initWithNibName:nil bundle:nil];
[self presentModalViewController:levelOne2 animated:NO];
[levelOne2 changeSpriteLocationTopPath];
}
This makes a regular transition where it just cuts to the other view. My question is how could i make this a fade transition? As in a long fade through black. Keep in mind i am not using a navigation controller, just #importing the view controller then using the above code. Thanks :)
Upvotes: 0
Views: 219
Reputation: 17478
See modalTransitionStyle
property of UIViewController.
Try the following
if (CGRectIntersectsRect(mainSprite.frame, backTopPathImg.frame))
{
levelOneViewController * levelOne2 = [[levelOneViewController alloc]initWithNibName:nil bundle:nil];
levelOne2.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:levelOne2 animated:YES];
[levelOne2 changeSpriteLocationTopPath];
}
Upvotes: 1
Reputation: 609
I would suggest having a UIView with a black background laid over top of your levelOne2
and over time change the opacity
of it from 1.0 to 0.0.
Here is a similar question: http://www.iphonedevsdk.com/forum/iphone-sdk-development/12998-how-fade-between-views-transitioning-through-black.html
Upvotes: 0