pushView animation in one page iPhone application? - iphone

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,

Related

How can I load a view from left side?

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
This function load a view from right side. How can I Load a view from left side?
Here it is
CATransition *animation = [CATransition animation];
[[self navigationController] pushViewController:elementController animated:NO];
[animation setDuration:0.45];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
[[elementController.view layer] addAnimation:animation forKey:#"SwitchToView1"];
For this you have to #import <QuartzCore/QuartzCore.h>
don't think there is a readymade way to do that. You will have to animate the view yourself using animateWithDuration:delay:options:animations:completion: or animateWithDuration:animations:completion: (or any other animation methods) and change frames of your view accordingly so that it animates from the right side.
Hope this helps :)
if you already been pushed to a viewController you can use this:
[self.navigationController popViewControllerAnimated:YES]

I want to animate an UIImageView & during animation I want to recognize event on it

When am animating a UIImageView it doesn't send event during it is animating, but when it finishes its animation, that time it is able to send event, I'v tried UIButton too.
You just need to include the UIViewAnimationOptionAllowUserInteraction option when invoking the animation:
[UIView animateWithDuration:animationDuration
delay:0
options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction)
<snip>];
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.0];// try 0.1 also
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
kCAMediaTimingFunctionEaseInEaseOut]];
[[yourImageView layer] addAnimation:animation forKey:#"transitionViewAnimation"];//Try self.view insted of yourImageView if you want to animate whole view

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

How to give page curl animation in webView?

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.

fade transition in iphone (forward and backwards)

I'm almost done coding my project and I have come across 1 to 2 problems with the fading. Here is what my code looks like
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionFade];
[animation setSubtype:kCATransitionFromRight, kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
It's telling me to set a subtype. I basically want to animate going back and going forward. I know i'm pretty close. What else am i missing from the code?
As near as I can tell -setSubtype: takes one NSString* argument.
The line:
[animation setSubtype:kCATransitionFromRight, kCATransitionFromLeft];
should probably be either:
[animation setSubtype:kCATransitionFromRight];
or:
[animation setSubtype:kCATransitionFromLeft];
EDIT: You may also want to add:
[[myView layer] addAnimation:animation forKey:#"transitionFromRight"];
to begin animating your myView object (which is a UIView or subclass).
From the transitions example you can use braces instead of , notice the correct curly braces: { around the type and subtype instead of the brackets: [:
NSString *types[4] = {kCATransitionMoveIn,
kCATransitionPush, kCATransitionReveal, kCATransitionFade};
NSString *subtypes[4] = {kCATransitionFromLeft,
kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom};