惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
罗磊的独立博客
F
Fortinet All Blogs
T
Threatpost
Y
Y Combinator Blog
博客园_首页
美团技术团队
Security Latest
Security Latest
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
V
V2EX - 技术
The Cloudflare Blog
L
LINUX DO - 热门话题
博客园 - 司徒正美
Jina AI
Jina AI
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
The Hacker News
The Hacker News
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Latest news
Latest news
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cisco Blogs
雷峰网
雷峰网
Application and Cybersecurity Blog
Application and Cybersecurity Blog
B
Blog RSS Feed
W
WeLiveSecurity
D
DataBreaches.Net
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
Spread Privacy
Spread Privacy
Know Your Adversary
Know Your Adversary
TaoSecurity Blog
TaoSecurity Blog
S
Securelist
Help Net Security
Help Net Security

博客园 - 英怀

获取当前页面url中的参数 coffeescript+node.js+angular 转 iphone开发资料汇总(很多实用的东东) 给状态条加上图标的代码 设置uiview背景图的方法之一 xcode 4 下找EXC_BAD_ACCESS错误原因 转--如何解决EXC_BAD_ACCESS错误 关于Iphone开发得一些案例及常用知识(转过来的参考用) 用uiwebview打开pdf,word,excel 网络请求侦听工具 整理 被appstore 拒绝审核通过的原因 Capture iPhone Simulator Screenshots 将NSString转换编码集变为GBK或GB2312 转,ios开源程序集 在程序中如何把两张图片合成为一张图片 - 英怀 怎么让一个UIImageView响应点击事件呢 - 英怀 object c 操作date类型 - 英怀 在model view中隐藏键盘代码 - 英怀 iphone view与view翻转的动画效果 - 英怀 使用NSUserDefaults保存简单的用户数据 - 英怀
再转动画实现
英怀 · 2011-08-31 · via 博客园 - 英怀



最普通动画:
//开始动画
[UIView beginAnimations:nil context:nil];  
//设定动画持续时间
[UIView setAnimationDuration:2];
//动画的内容
frame.origin.x += 150;
[img setFrame:frame];
//动画结束
[UIView commitAnimations];

连续动画:一个接一个地显示一系列的图像
NSArray *myImages = [NSArray arrayWithObjects: 
[UIImage imageNamed:@"myImage1.png"], 
[UIImage imageNamed:@"myImage2.png"], 
[UIImage imageNamed:@"myImage3.png"], 
[UIImage imageNamed:@"myImage4.gif"], nil];

UIImageView *myAnimatedView = [UIImageView alloc]; 
[myAnimatedView initWithFrame:[self bounds]]; 
myAnimatedView.animationImages = myImages; //animationImages属性返回一个存放动画图片的数组
myAnimatedView.animationDuration = 0.25; //浏览整个图片一次所用的时间
myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 动画重复次数
[myAnimatedView startAnimating]; 
[self addSubview:myAnimatedView]; 
[myAnimatedView release]; 

CATransition Public API动画:
CATransition *animation = [CATransition animation];
//动画时间
    animation.duration = 0.5f;
//先慢后快
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
//animation.removedOnCompletion = NO;

//各种动画效果
/*
kCATransitionFade;
kCATransitionMoveIn;
kCATransitionPush;z
kCATransitionReveal;
*/
/*
kCATransitionFromRight;
kCATransitionFromLeft;
kCATransitionFromTop;
kCATransitionFromBottom;
*/
//各种组合
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromRight; 

[self.view.layer addAnimation:animation forKey:@"animation"];

CATransition Private API动画:
animation.type可以设定为以下效果
动画效果汇总:
/*
 suckEffect(三角)

 rippleEffect(水波抖动)

 pageCurl(上翻页)

 pageUnCurl(下翻页)

 oglFlip(上下翻转)

 cameraIris/cameraIrisHollowOpen/cameraIrisHollowClose  (镜头快门,这一组动画是有效果,只是很难看,不建议使用



UIView Animations 动画:
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
//以下四种效果
/*
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];//oglFlip, fromLeft 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];//oglFlip, fromRight  
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
*/

[self.view exchangeSubviewAtIndex:1 withSubviewAtIndex:0];
[UIView commitAnimations];
IOS4.0新方法:
方法: +(void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations;
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion; //多一个动画结束后可以执行的操作.

//下边是嵌套使用,先变大再消失的动画效果.
[UIView animateWithDuration:1.25 animations:^{
CGAffineTransform newTransform = CGAffineTransformMakeScale(1.21.2);
[firstImageView setTransform:newTransform];
[secondImageView setTransform:newTransform];} 
completion:^(BOOL finished){
[UIView animateWithDuration:1.2 animations:^{
[firstImageView setAlpha:0];
[secondImageView setAlpha:0];} completion:^(BOOL finished){ 
[firstImageView removeFromSuperview]; 
[secondImageView removeFromSuperview]; }]; 
}];