//添加
- (IBAction)add:(id)sender
{
[UIView beginAnimations:@"animation" context:nil];
//设置动画时长
[UIView setAnimationDuration:2.0];
//动画类型
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
//添加动画
[UIView commitAnimations];
}
//翻页
//动画类型
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
//移入
- (IBAction)immigration:(id)sender
{
CATransition *transition = [CATransition animation];
transition.duration = 2.0;
//类型
transition.type = kCATransitionMoveIn;
//动画方向
transition.subtype = kCATransitionFromLeft;
[self.view.layer addAnimation:transition forKey:@"animation"];
//置换
[self.view exchangeSubviewAtIndex:2 withSubviewAtIndex:3];
}
//揭开
//类型
transition.type = kCATransitionReveal;
//动画方向
transition.subtype = kCATransitionFromTop;
//立方体
// 使用@"cube"动画
transition.type = @"cube";
// 指定动画方向,从左到右
transition.subtype = kCATransitionFromLeft;
//收缩
// 使用@"suck"动画, 该动画与动画方向无关
transition.type = @"suckEffect";
// 指定动画方向,从左到右
transition.subtype = kCATransitionFromLeft;
//翻转
// 使用@"oglFlip"动画
transition.type = @"oglFlip";
// 指定动画方向,从左到右
transition.subtype = kCATransitionFromLeft;
//水波
// 使用@"rippleEffect"动画,该动画与方向无关
transition.type = @"rippleEffect";