tags:

views:

57

answers:

2

how can we give page curl effect for ModalViewController can we give custom animation if i use this code

PageThreeViewController *pagethreecontroller = [[PageThreeViewController alloc] 
               initWithNibName:@"PageThreeViewController" bundle:nil];


   //UIViewAnimationTransition trans = UIViewAnimationTransitionCurlUp;
   [UIView beginAnimations: nil context: nil];
   [UIView setAnimationDuration:1.0];
   [UIView setAnimationBeginsFromCurrentState:YES];
   [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[self view] cache:NO];
   // do your view swapping here

   //[UIView setAnimationTransition: trans forView: [self view] cache: YES];
   [self presentModalViewController: pagethreecontroller animated: NO];
   [UIView commitAnimations];

I doesnot seem to work please help me Thanks in advance

A: 

Try setting the transition on the [delegate window] instead of [self view]. That's how I did it to replace the standard animations for a UINavigation controller. The whole snippet I used is in my answer here.

Shawn Craver
i dont have navigation in my app
madhavi
yes, but I think if you just change this line: [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[self view] cache:NO];to this: [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[AppDelegate window] cache:NO];Then what you have may work.
Shawn Craver
+1  A: 

On iPhone OS 3.2 and later (including 4.0) you could just use:

PageThreeViewController *pagethreecontroller = [[PageThreeViewController alloc] 
               initWithNibName:@"PageThreeViewController" bundle:nil];


pagethreecontroller.modalTransitionStyle = UIModalTransitionStylePartialCurl;


[self presentModalViewController: pagethreecontroller animated: YES];

Note that, the animation will stop before the curl is complete (hence "partial" curl). This may not be what you like.

KennyTM
i know this but i dont want this animation as some say it is undocumented and anyway i dont want partial curl :( thanks for help
madhavi
@mad: [Who said it's undocumented?!](http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/c_ref/UIModalTransitionStylePartialCurl)
KennyTM