Wednesday, November 9, 2011

CATransition OR UIView begin animation


CATransition gives more control and its reusable.

CATransition *myAnimationView = [CATransition animation];
[myAnimationView setDuration:1];
[myAnimationView setType:kCATransitionReveal];
[myAnimationView setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[[viewHere layer] addAnimation:myAnimationView forKey:kCATransitionReveal];




UIView animation is for common animation effect eg. flip left, flip right, curl up, curl down

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:viewHere cache:YES];
[viewHere removeFromSuperview];
[UIView commitAnimations];

No comments: