1.普通动画:
[UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:2]; frame.origin.x += 150; [img setFrame:frame]; [UIView commitAnimations];
2.连续动画(一系列图像):
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.png"], nil]; UIImageView *myAnimatedView = [[UIImageView alloc] initWithFrame:[self bounds]]; myAnimatedView.animationImages = myImage; myAnimatedView.animationRepeatCount = 0; [myAnimatedView startAnimating]; [self addSubview:myAnimatedView]; [my AnimatedView release];
3.CATransition Public API:
CATransition *animation = [CATransition animation]; animation.duration = 0.5f; animation.timingFunction = UIViewAnimationCurveEaseInOut; animation.fillMode = KCAFillModeForwards; //各种动画效果 /* KCATransitionFade; KCATransitionMoveIn; KCATransitionPush; KCATransitionReveal; */ /* KCATransitionFromeRight; KCATransitionFromLeft; KCATransitionFormTop; kCATransitionFromButtons; */ //各种组合 animation.type = KCATransitionPush; animation.subtype = KCATransitionFromRight; [self.view.layer addAnimation:animation forKey:@"animation"];
4.UIView Animations动画:
[UIView beginAnimations:@"animationID" context:nil]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationRepeatAutoreverses:NO]; //以下四种效果 /* [UIView setAnimationTransition:UIViewAnimationTransitionFlipFormLeft forView:self.view cache:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFormRight forView:self.view cache:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES]; */
5.嵌套使用,先变大再消失
[UIView animateWithDuration:1.25 aniamtions:^{
CGAffineTransform newTRansform = CGAffineTransformMakeScale(1.2, 1.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];
}
];
}
];
以上所述是小编给大家介绍的iOS自带动画效果的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
# ios动画效果
# iOS中给自定义tabBar的按钮添加点击放大缩小的动画效果
# iOS点击查看大图的动画效果
# iOS仿支付宝芝麻信用分数仪表盘动画效果
# iOS 屏幕解锁文字动画效果
# iOS实现知乎和途家导航栏渐变的文字动画效果
# IOS实现视频动画效果的启动图
# Android UI设计系列之自定义SwitchButton开关实现类似IOS中UISwi
# 基于JS实现Android
# iOS一个手势动画效果
# IOS框架Spring常用的动画效果
# IOS等待时动画效果的实现
# iOS使用UICountingLabel实现数字变化的动画效果
# 小编
# 在此
# 给大家
# 自带
# 四种
# 所述
# 给我留言
# 变大
# 感谢大家
# 疑问请
# 有任何
# UIImageView
# initWithFrame
# alloc
# myAnimatedView
# imageNamed
# UIImage
# startAnimating
# png
# Public
相关文章:
定制建站流程步骤详解:一站式方案设计与开发指南
如何挑选高效建站主机与优质域名?
行程制作网站有哪些,第三方机票电子行程单怎么开?
PHP正则匹配日期和时间(时间戳转换)的实例代码
盐城做公司网站,江苏电子版退休证办理流程?
建站之星如何防范黑客攻击与数据泄露?
如何在Golang中处理模块冲突_解决依赖版本不兼容问题
建站之星展会模版如何一键下载生成?
已有域名和空间如何快速搭建网站?
如何快速上传自定义模板至建站之星?
建站之星客服服务时间及联系方式如何?
详解ASP.NET 生成二维码实例(采用ThoughtWorks.QRCode和QrCode.Net两种方式)
广州建站公司哪家好?十大优质服务商推荐
Bpmn 2.0的XML文件怎么画流程图
南京做网站制作公司,南京哈发网络有限公司,公司怎么样,做网页美工DIV+CSS待遇怎么样?
寿县云建站:智能SEO优化与多行业模板快速上线指南
,sp开头的版面叫什么?
建站OpenVZ教程与优化策略:配置指南与性能提升
上海网站制作网站建设公司,建筑电工证网上查询系统入口?
如何在Windows环境下新建FTP站点并设置权限?
建站之星代理如何优化在线客服效率?
电商平台网站制作流程,电商网站如何制作?
制作网站的基本流程,设计网站的软件是什么?
如何零基础开发自助建站系统?完整教程解析
活动邀请函制作网站有哪些,活动邀请函文案?
北京制作网站的公司,北京铁路集团官方网站?
如何用PHP工具快速搭建高效网站?
香港服务器网站生成指南:免费资源整合与高速稳定配置方案
微网站制作教程,我微信里的网站怎么才能复制到浏览器里?
零基础网站服务器架设实战:轻量应用与域名解析配置指南
攀枝花网站建设,攀枝花营业执照网上怎么年审?
如何通过NAT技术实现内网高效建站?
如何在阿里云高效完成企业建站全流程?
如何快速生成高效建站系统源代码?
制作网页的网站有哪些,电脑上怎么做网页?
C++中的Pimpl idiom是什么,有什么好处?(隐藏实现)
,怎么在广州志愿者网站注册?
SAX解析器是什么,它与DOM在处理大型XML文件时有何不同?
视频网站制作教程,怎么样制作优酷网的小视频?
c# 在ASP.NET Core中管理和取消后台任务
如何通过VPS建站实现广告与增值服务盈利?
建设网站制作价格,怎样建立自己的公司网站?
Python路径拼接规范_跨平台处理说明【指导】
唐山网站制作公司有哪些,唐山找工作哪个网站最靠谱?
如何在IIS中配置站点IP、端口及主机头?
建站主机选哪家性价比最高?
C++中引用和指针有什么区别?(代码说明)
建站之星如何实现PC+手机+微信网站五合一建站?
表情包在线制作网站免费,表情包怎么弄?
建站之星后台密码遗忘或太弱?如何重置与强化?
*请认真填写需求信息,我们会在24小时内与您取得联系。