chourobin
chourobin

Reputation: 4124

custom UIView animation in dismissModalViewController

Where is the correct place to put custom animation code for dismissing a modalviewcontroller.

I tried putting the following into viewdiddisappear, viewwilldisappear but doesn't behave correctly. Any thoughts? THanks!!

[UIView beginAnimations:@"suck" context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:103 forView:self.navigationController.view cache:YES];
[UIView setAnimationPosition:CGPointMake(260, 431)];
[UIView commitAnimations];

Upvotes: 0

Views: 1190

Answers (2)

chourobin
chourobin

Reputation: 4124

I think I figured it out. I followed the example in:

http://developer.apple.com/library/ios/#samplecode/BubbleLevel/Introduction/Intro.html

Basically removed the second view from superview and inserted the first view back in. The transition works correctly afterwords.

THanks for the help.

Upvotes: 0

HappyAppDeveloper
HappyAppDeveloper

Reputation: 469

Try this:

UIViewController *myController = [[[MyViewController alloc] init] autorelease];
UIViewAnimationTransition transition = UIViewAnimationTransitionCurlUp; // or whatever effect you want
[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:transition forView:[self window] cache:YES];
[navController presentModalViewController:myController animated:NO]; // or dismissModalViewController in your case
[UIView commitAnimations];

Upvotes: 2

Related Questions