ios怎样在imageView实现动画
1个回答
展开全部
在ios教程中有很多种办法能够为imageView添加图片实现动画,专门整理了本篇为imageView添加图片实现动画的总结,希望能帮助到大家。
//为图片设置动态 self.imageView.animationImages = animateArray; //为动画设置持续时间 self.imageView.animationDuration = 3.0;
//创建imageView self.imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(0, 40, 320, 260)];
//把图片添加到动态数组 NSMutableArray * animateArray = [[NSMutableArrayalloc]initWithCapacity:20]; [animateArray addObject:[UIImage imageNamed:@"t1.png"]]; [animateArray addObject:[UIImage imageNamed:@"t2.png"]]; [animateArray addObject:[UIImage imageNamed:@"t3.png"]]; [animateArray addObject:[UIImage imageNamed:@"t4.png"]]; [animateArray addObject:[UIImage imageNamed:@"t5.png"]]; [animateArray addObject:[UIImage imageNamed:@"t6.png"]]; [animateArray addObject:[UIImage imageNamed:@"t7.png"]]; [animateArray addObject:[UIImage imageNamed:@"t8.png"]]; [animateArray addObject:[UIImage imageNamed:@"t9.png"]]; [animateArray addObject:[UIImage imageNamed:@"t10.png"]]; [animateArray addObject:[UIImage imageNamed:@"t11.png"]]; [animateArray addObject:[UIImage imageNamed:@"t12.png"]]; [animateArray addObject:[UIImage imageNamed:@"t13.png"]]; [animateArray addObject:[UIImage imageNamed:@"t14.png"]]; [animateArray addObject:[UIImage imageNamed:@"t15.png"]]; [animateArray addObject:[UIImage imageNamed:@"t16.png"]]; [animateArray addObject:[UIImage imageNamed:@"t17.png"]]; [animateArray addObject:[UIImage imageNamed:@"t18.png"]]; [animateArray addObject:[UIImage imageNamed:@"t19.png"]]; [animateArray addObject:[UIImage imageNamed:@"t20.png"]];
//开始播放动画 [self.imageView startAnimating];
//为默认的无限循环 self.imageView.animationRepeatCount = 0; [self.view addSubview:self.imageView];
//为图片设置动态 self.imageView.animationImages = animateArray; //为动画设置持续时间 self.imageView.animationDuration = 3.0;
//创建imageView self.imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(0, 40, 320, 260)];
//把图片添加到动态数组 NSMutableArray * animateArray = [[NSMutableArrayalloc]initWithCapacity:20]; [animateArray addObject:[UIImage imageNamed:@"t1.png"]]; [animateArray addObject:[UIImage imageNamed:@"t2.png"]]; [animateArray addObject:[UIImage imageNamed:@"t3.png"]]; [animateArray addObject:[UIImage imageNamed:@"t4.png"]]; [animateArray addObject:[UIImage imageNamed:@"t5.png"]]; [animateArray addObject:[UIImage imageNamed:@"t6.png"]]; [animateArray addObject:[UIImage imageNamed:@"t7.png"]]; [animateArray addObject:[UIImage imageNamed:@"t8.png"]]; [animateArray addObject:[UIImage imageNamed:@"t9.png"]]; [animateArray addObject:[UIImage imageNamed:@"t10.png"]]; [animateArray addObject:[UIImage imageNamed:@"t11.png"]]; [animateArray addObject:[UIImage imageNamed:@"t12.png"]]; [animateArray addObject:[UIImage imageNamed:@"t13.png"]]; [animateArray addObject:[UIImage imageNamed:@"t14.png"]]; [animateArray addObject:[UIImage imageNamed:@"t15.png"]]; [animateArray addObject:[UIImage imageNamed:@"t16.png"]]; [animateArray addObject:[UIImage imageNamed:@"t17.png"]]; [animateArray addObject:[UIImage imageNamed:@"t18.png"]]; [animateArray addObject:[UIImage imageNamed:@"t19.png"]]; [animateArray addObject:[UIImage imageNamed:@"t20.png"]];
//开始播放动画 [self.imageView startAnimating];
//为默认的无限循环 self.imageView.animationRepeatCount = 0; [self.view addSubview:self.imageView];
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询