iphone - 更平滑的慢速旋转 UIImage

标签 iphone ios objective-c animation image-rotation

我正在尝试制作一个 iPhone/iPad 应用程序,目前正在尝试让图像缓慢旋转 360 度。但是当我增加动画持续时间时,图片会旋转 1/4,然后重置回动画的开头。

谁能告诉我这有什么问题吗?

到目前为止我所拥有的:

CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[fullRotation setFromValue:[NSNumber numberWithFloat:0]];
[fullRotation setToValue:[NSNumber numberWithFloat:((2*M_PI))]];
fullRotation.speed = .5f;
fullRotation.duration = 5.5;
fullRotation.repeatCount = 1;

fullRotation.repeatCount = HUGE_VALF;

[[cosmic layer] addAnimation:fullRotation forKey:@"transform.rotation"];

最佳答案

只需从代码中删除这一行:

fullRotation.speed = .5f;

然后调整您想要的持续时间。

关于iphone - 更平滑的慢速旋转 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16656910/

相关文章:

objective-c - 从 Objective C 中的数据库向数组列表收件人发送邮件

ios - 在 Swift 中使用 'Any' 有什么意义?什么时候使用 'Any' 什么时候使用 'AnyObject' ?

iphone - 将 iPad/iPhone 应用程序与 Rails 应用程序集成

html - 绝对定位的容器隐藏了超出屏幕高度的内容

ios - 自定义 UIButton,发送到实例的无法识别的选择器

ios - dequeueReusableCellWithIdentifier 索引越界

ios - 如何找到 NSMutableArray 的最小和最大对象

iphone - AVQueuePlayer和 Audio Session 问题

ios - Apple Watch 上的 WCSession 无法正常工作

iOS 辅助功能隐藏 "textField, double tap to edit"公告