views:

418

answers:

2

if i run following gives error,current controller is table controller....

SetController *aSecondView = [[SetController alloc] initWithNibName:@"Sets" bundle:nil]; SchedAppDelegate *mainDelegate = (SchedAppDelegate *)[[UIApplication sharedApplication] delegate]; [mainDelegate setSettingsViewController:aSecondView]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:[[self view] superview] cache:YES]; [self.view removeFromSuperview]; [self presentModalViewController:aSecondView animated:NO]; //[aSecondView release]; [UIView commitAnimations];

+2  A: 

It appears that mView is a UIViewController and not a UIView.

This is the proper way to apply a custom animation to a modal view controller:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[self view] cache:YES];
[self presentModalViewController:mView animated:NO];
[UIView commitAnimations];
rpetrich
did you run it,i checked ,it did not work for UIViewAnimationTransitionFlipFromRight
Mikhail Naimy
have you tried forView:[[self view] superview] instead? Also, I don't have your code, so there's no way I'd be able to test it
rpetrich
i tried it. but i could not do it.i have edited with my complete codecan u see and answer?
Mikhail Naimy
Yeah, this doesn't work for me either. For one thing, if there's a navigation bar then using [self view] for the animation view isn't going to work.
sbwoodside
+2  A: 

If mView is a view controller, you can present it with a flip animation by doing the following:

mView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:mView animated:YES];

The modalTransitionStyle property is only available for iPhone OS 3.0 onwards. Hope this helps. :)

Daniel Tull