7

I am using this code for Page curl effect ....Its work fine in simulator and device... But its not (setType:@"pageCurl") apple documented api , this caused it to be rejected by the iPhone Developer Program during the App Store review process:

animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
animation.startProgress = 0.5;
animation.endProgress   = 1;
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:@"pageCurl"];
[animation setSubtype:@"fromRight"];
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
[[imageView layer] addAnimation:animation 
                         forKey:@"pageFlipAnimation"]; 

So i changed and using like this

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationDelegate:self];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationWillStartSelector:@selector(transitionWillStart:finished:context:)];
[UIView setAnimationDidStopSelector:@selector(transitionDidStop:finished:context:)];
// other animation properties
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp 
                       forView:imageView cache:YES];
// set view properties
[UIView commitAnimations];

In this above code i want to stop the page curl effect at midway.. But i cant stop it in midway like map applications in ipod... Is this any fix for this? or Is there any apple documented methods used for page curl effect in ipod touch?

I am searching lot. but didnt get any answer ? can anyone help me? Thanks in advance..plz

epatel
  • 45,805
  • 17
  • 110
  • 144
  • Hello there. So u did use the type @pagecurl and the app got rejected? – user281300 Jan 29 '11 at 00:22
  • If you'd like to do a partial curl, but keep a Toolbar stationary, as in Apple's Maps app, check out my solution [here](http://stackoverflow.com/a/11406056/1148702). – Tim Arnold Jul 10 '12 at 14:49

4 Answers4

9

If I may?

SampleViewController *sampleView = [[[SampleViewController alloc] init] autorelease];
[sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:sampleView animated:YES];

......

Paul Peelen
  • 10,073
  • 15
  • 85
  • 168
Chris Pemberton
  • 146
  • 1
  • 3
4

I found a solution to add an UIView to UIViewController using Animation block.

m_Container is an UIView who contain my view animation (self). self is an UIView.

CAUTION : You need to have import QuartzCore

To present view with page curl animation you can use :

-(void)PresentView
{
    [UIView animateWithDuration:1.0 
                     animations:^{
                         CATransition *animation = [CATransition animation];
                         [animation setDelegate:self];
                         [animation setDuration:0.7];
                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
                         animation.type = @"pageCurl";
                         animation.fillMode = kCAFillModeForwards;
                         animation.endProgress = 0.65;
                         [animation setRemovedOnCompletion:NO];
                         [m_container.layer addAnimation:animation forKey:@"pageCurlAnimation"];  
                         [m_container addSubview:self];
                         ;}  
     ];    
}

And when you want hide this view you can use :

-(void)HideHelpView
{
    [UIView animateWithDuration:1.0 
                     animations:^{
                         CATransition *animation = [CATransition animation];
                         [animation setDelegate:self];
                         [animation setDuration:0.7];
                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
                         animation.type = @"pageUnCurl";
                         animation.fillMode = kCAFillModeForwards;
                         animation.startProgress = 0.35;
                         [animation setRemovedOnCompletion:NO];
                         [m_container.layer addAnimation:animation forKey:@"pageUnCurlAnimation"];  
                         [self removeFromSuperview];

                         ;}  
     ];

}
halfer
  • 19,824
  • 17
  • 99
  • 186
TheRonin
  • 1,305
  • 1
  • 12
  • 18
  • This code is incorrect. The arguments to CATransition setTimingFunction: are of type UIViewAnimationCurve, not CAMediaTimingFunction. Use CAMediaTimingFunction functionWithName: to get a timing function. – titaniumdecoy Jan 03 '12 at 18:22
1

Must the stop-at-mide-point page curl effect be used? The easiest method is to replace page curl by a simpler animation (e.g. slide-out), or just curl the whole view up.

You may try to cheat by constructing the string at run time e.g.

[animation setType:[@"page" stringByAppendingString:@"Curl"]];

although you're still using an undocumented method.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
0

Partial curling is officially supported since SDK 3.2. Check the sample code of Chris. More information can be found in the UIViewController Class Reference under Constants.

Jan
  • 21
  • 4
  • This does not appear to function the same as Maps. That is to say you can apply this transition to the whole view, but not a subview and therefore leaving the toolbar. – Jason McCreary Oct 25 '10 at 03:29