How to give page curl animation in webView? - iphone

I am working on PDF Reader application. if i display pdf file then i am not able to change font size of this.
So i display ePub file in UIWebView. But my problem is how to add page curl animation in UIWebView like iBook and kindle apps does.

I have created a UIWebView named myWebView and on clicking the button the curl effect will be shown on the webview:-
-(IBAction) nextPageAnimationForWebView{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
animation.startProgress = 0.5;
animation.endProgress = 1;
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:#"pageCurl"];
//[animation setType:kcat];
[animation setSubtype:kCATransitionMoveIn];
[animation setRemovedOnCompletion:NO];
[animation setFillMode: #"extended"];
[animation setRemovedOnCompletion: NO];
[[myWebView layer] addAnimation:animation forKey:#"WebPageCurl"];
}
Please tell if this solved your answer.

Related

pushView animation in one page iPhone application?

i have a web based application with only one view controller. i have some shortcut buttons in my app which will load some urls. what i need is a push animation as like
pushViewController each time when i click the shortCut buttons.
i have only one UIView .
so, i have found the solution myself,
push like animation for any view
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[self.view layer] addAnimation:animation forKey:#"SwitchToView1"];
thanks for your feedbacks,

How can I give Page flip effect in `UIScrollview`?

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?
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.

UIPageViewController transition speed / duration?

Is there any way to change the default duration of the page curl transition?
It is way to fast then I wish it will be?
Thanks
Shani
Here is the way to to use default transition to curl the page and to specify the speed of the curl.
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
animation.startProgress = 0.2;
animation.endProgress = 1;
if (isGoingBackward) {
[animation setType:#"pageUnCurl"];
[animation setSubtype:kCATransitionFromTop];
}
else
{
[animation setType:#"pageCurl"];
[animation setSubtype:kCATransitionFromLeft];
}
[animation setFillMode: kCAFillModeBackwards];
[self.view.layer addAnimation:animation forKey:#"animation"];

CATransition page curl from top

I wanted to know if anyone managed a pagecurl from the top using the CATRANSITION. I have the following :
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.35];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
animation.type = #"pageCurl";
animation.subtype = kCATransitionFromTop;
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 0.30;
[animation setRemovedOnCompletion:NO];
[self.view.layer addAnimation:animation forKey:#"pageCurlAnimation"];
but unfortunately, it always does the page curl from the bottom. I will be very grateful if anyone can tell me how to do a page curl from the top.
Many thanks.
I've got this working. You need to set animation.type = #"pageUnCurl"; - who would have thought! Thanks apple.
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.5];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = #"pageUnCurl";
animation.subtype = kCATransitionFromTop;
animation.fillMode = kCAFillModeForwards;
animation.startProgress = 0.3;
[animation setRemovedOnCompletion:NO];
[self.helpView.layer addAnimation:animation forKey:#"pageCurlAnimation"];
Found the answer, need to set subtype to from right!
subtype = KCATransitionFromLeft or KCATransitionFromRight
you can also remove the animation.endProgress if you want a total animation of curl page .
=)

iphone page curl without uiviewanimation

I am trying to do a partial page curl with the following:
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0f];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:(notCurled ? #"mapCurl" : #"mapUnCurl")];
[animation setRemovedOnCompletion:NO];
[animation setFillMode: #"extended"];
[animation setRemovedOnCompletion: NO];
notCurled = !notCurled;
[[delegate.window layer] addAnimation:animation forKey:#"pageFlipAnimation"];
Unfortunately, it does not do anything . I am using the latest SDK. I remember being able to use this in 3.0.
Thanks.
Ok it seems that the above does not work anymore, I am using the following now:
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.35];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
animation.type = #"pageCurl";
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 0.65;
[animation setRemovedOnCompletion:NO];
[self.view.layer addAnimation:animation forKey:#"pageCurlAnimation"];