iOS中 imageview 如何循环平移动画

qq_27277773 2016-08-25 05:26:21
代码如下
[UIView animateWithDuration:3 animations:^{
[imageview setTransform:(CGAffineTransformMakeTranslation(-600,0))];
[imageview setAlpha:0];
[imageview setAnimationRepeatCount:0];
}
];

只能循环平移动画一次?如何一直循环下去
...全文
917 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Haley_Wong 2016-08-29
  • 打赏
  • 举报
回复
有两种方式: 这是方法一(你设置重复次数的对象调用错了): [UIView animateWithDuration:3 animations:^{ [self.webView setTransform:(CGAffineTransformMakeTranslation(-600,0))]; [self.webView setAlpha:0]; [UIView setAnimationRepeatCount:0]; }]; 这是方法二: // 把这个动画封装成一个方法 [UIView animateWithDuration:3 animations:^{ [self.webView setTransform:(CGAffineTransformMakeTranslation(-600,0))]; [self.webView setAlpha:0]; } completion:^(BOOL finished) { // 在这里再调用这个方法本身 }];
qq_35996263 2016-08-29
  • 打赏
  • 举报
回复
[UIView setAnimationRepeatCount:0];0 改为MAXFLOAT试下
目生鱼 2016-08-26
  • 打赏
  • 举报
回复
用CABaseAnimation啊。设置重复次数为最大整数

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧