user141302
user141302

Reputation:

presentModalViewController gives error?

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];

Upvotes: 0

Views: 1119

Answers (2)

Daniel Tull
Daniel Tull

Reputation: 1736

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. :)

Upvotes: 3

rpetrich
rpetrich

Reputation: 32316

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];

Upvotes: 3

Related Questions