ios - 像雷达 Objective-C 那样的动画

标签 ios objective-c uiview clock uianimation

我如何制作像雷达一样的 UIView 动画? 我已经有了一个 UIView,其中包含使用 drawrect 创建的圆圈,但是我如何创建一条线,做一个时钟动画?

如下图: enter image description here

最佳答案

如果您已经拥有所有这些图像,那么您只需要一个雷达线动画。

您可以使用此代码旋转雷达线:

- (void) startAnimation {

CABasicAnimation *radarHand;

radarHand = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];

radarHand.fromValue = [NSNumber numberWithFloat:fromAngle+M_PI];

radarHand.byValue = [NSNumber numberWithFloat:((360*M_PI)/180)];

radarHand.duration = 60.0f;

radarHand.repeatCount = HUGE_VALF;

}

(猜雷达线 - 半透明图像也在那里。)

希望对您有所帮助。

关于ios - 像雷达 Objective-C 那样的动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15483410/

相关文章:

iOS/swift : two rows with same dequeue nib and identifier

iphone - 应用程序在模拟器上运行良好,但在设备上崩溃

iOS 运行时 : Use Case

swift - 手势识别器不工作。执行下面元素的操作 - SWIFT

ios - 多个 UITableViews 在一个 UIViewController 中一次可见

ios - GCD dispatch_async 是否等待 NSLog()?

ios - UIApplicationInvalidInterfaceOrientation 问题

iphone - 字符串中的子串整数

ios - 在视觉格式语言中给予 View 相同的位置

ios - 从 accessibilityLabel 获取 UIVIew 用于 KIF 自动化