Reputation: 5602
I am working on an application in which I am using UIScrollview
, in that I need to use page flip effect.
How can I give Page flip effect in UIScrollview
?
Note: In UIScrollview when we change Page at that time Scrolling the Page forward & backward. Can it be possible to give Page scroll effect at the time when we scroll page?
Upvotes: 3
Views: 4358
Reputation: 2076
Forward flip -
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
animation.startProgress = 0;
animation.endProgress = 1;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = @"pageCurl";
animation.subtype=@"fromRight";
animation.fillMode = kCAFillModeForwards;
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
[lyr addAnimation:animation forKey:@"WebPageCurl"];
Backward flip -
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.5f];
animation.startProgress = 0;
animation.endProgress = 1;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = @"pageUnCurl";
animation.subtype=@"fromRight";
animation.fillMode = kCAFillModeBackwards;
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
[lyr addAnimation:animation forKey:@"WebPageCurl"];
you can use this code when UIScrollView delegates.
Upvotes: 8