ios怎样在imageView实现动画
展开全部
在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; [sel
//为图片设置动态 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; [sel
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询