我如何制作像雷达一样的 UIView 动画? 我已经有了一个 UIView,其中包含使用 drawrect 创建的圆圈,但是我如何创建一条线,做一个时钟动画?
如下图:
最佳答案
如果您已经拥有所有这些图像,那么您只需要一个雷达线动画。
您可以使用此代码旋转雷达线:
- (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/