// // ViewController.m // AnimationY // // Created by ldci on 13-4-14. // Copyright (c) 2013年 ldci. All rights reserved. // #import "ViewController.h" #import "QuartzCore/QuartzCore.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)dealloc { [_pView release]; [_imgView1 release]; [_imgView2 release]; [_pView release]; [super dealloc]; } - (IBAction)butUP:(id)sender { [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0]; //找到image View的父View UIView *beginView = self.pView; //将卷曲动画应用到父View //UIViewAnimationTransitionCurlUp [UIView setAnimationTransition: UIViewAnimationTransitionCurlDown forView:beginView cache:YES]; [beginView exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; [UIView commitAnimations]; } - (IBAction)btnLeft:(id)sender { [self actAnimation:0]; } - (IBAction)btnDown:(id)sender { [self actAnimation:1]; } - (IBAction)btnRight:(UIButton *)sender { [self actAnimation:2]; } - (IBAction)btnCenter:(id)sender { [self actAnimation:3]; } -(void)actAnimation:(int) type{ CATransition *animation = [CATransition animation]; animation.duration = 1.0f; animation.timingFunction= UIViewAnimationCurveEaseInOut ; switch(type){ case 0://淡入淡出 animation.type = kCATransitionFade; break; case 1://滑入 animation.type = kCATransition; break; case 2://推进 animation.type = kCATransitionPush; break; case 3:// animation.type = kCATransitionReveal; break; } //预定义一个基础变化 animation.subtype = kCATransitionFromRight; UIView *beginView = self.pView; //将卷曲动画应用到父View //UIViewAnimationTransitionCurlUp [UIView setAnimationTransition: UIViewAnimationTransitionCurlDown forView:beginView cache:YES]; [beginView exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; // 应用动画 [[beginView layer ]addAnimation:animation forKey:nil]; } @end
相关推荐
- [iOS动画和特效(一)UIView动画和CoreAnimation](http://liuyanwei.jumppo.com/2015/10/30/iOS-Animation-UIViewAndCoreAnimation.html) - [iOS动画和特效(二)UIKit力学行为]...
iOS核心动画高级技巧iOS核心动画高级技巧iOS核心动画高级技巧iOS核心动画高级技巧iOS核心动画高级技巧
iOS动画-animation1:博客相关代码
IOS过渡动画
iOS核心动画CABasicAnimation很简单的实现了图片的循环左右摆动。
iOS核心动画,iOS核心动画,iOS核心动画,iOS核心动画,iOS核心动画,iOS核心动画
iOS动画,UIKit动画 ,Core-Animation动画
实用,易用的 iOS 动画集合库.zip,在swift中简化ios动画的库。
iOS动画库的精选列表
此代码是IOS平台用xcode实现文字书写效果,以及动画。
IOS动画核心技术与案例实战
iOS 动画菜单 ContextMenu.iOS ,ContextMenu.iOS是一款效果很好的动画菜单,支持高度的自定义,适用于多种类型例如社交类应...
iOS动画效果集 CA360 ,CA360 包含 iOS 上的 Core Animation 的非常多的示例。
ios 动画交互的代码 ios 动画交互的代码 ios 动画交互的代码 ios 动画交互的代码 ios 动画交互的代码 ios 动画交互的代码
第四章iOS动画关键帧动画 深入学习关键帧动画 中文学习iOS动画很好的参考文档
ios动画的源码总结,封装了我们常见的动画内容.
iOS动画 - 几种特殊的layer动画
iOS 根据声波分贝峰值,使用贝塞尔曲线绘制动画,并可录音,使用avfundation系统框架。
iOS动画的测试代码, 写了一个测试的小例子, 可以理解iOS中动画的行为
iOS界面动画大全,各种常用动画,使用动画源码实现