有没有可能有像用户位置注解一样的辐射圈。以便自定义批注具有其他颜色的辐射状圆圈。如果没有,有没有办法让它正常工作呢?
发布于 2012-04-05 14:59:00
看看这个。你可以用它来做你需要做的事情。结合使用核心动画和子类化MKCircleView
或MKOverlayView
。
http://yickhong-ios.blogspot.com/2012/04/animated-circle-on-mkmapview.html
发布于 2011-10-25 09:34:43
可以创建执行此操作的UIView的自定义子类。具有两个子层的UIView,一个用于中心球,另一个用于扩展环。环状层和球层可以通过子类化CALayer并覆盖drawInContext来创建,因此您可以获得所需的任何颜色。代码可以使用这样的CAAnimationGroup来设置环的动画,以便它们同时扩展和淡出:
// expand the ring from the ball size to the ring's max size
CABasicAnimation *sizeAnim = [CABasicAnimation animationWithKeyPath:@"bounds"];
sizeAnim.fromValue = [NSValue valueWithCGRect:ballBounds];
sizeAnim.toValue = [NSValue valueWithCGRect:ringBoundsMax];
sizeAnim.duration = kRingExpansionTime;
// fade out the ring part way thru the animation
CABasicAnimation* alphaAnim = [CABasicAnimation animationWithKeyPath:@"opacity"];
alphaAnim.fromValue = [NSNumber numberWithFloat:1];
alphaAnim.toValue = [NSNumber numberWithFloat:0];
alphaAnim.beginTime = kRingExpansionTime * 0.7f; // start part way thru
alphaAnim.duration = kRingExpansionTime - alphaAnim.beginTime;
CAAnimationGroup* group = [CAAnimationGroup animation];
group.duration = kRingExpansionTime;
group.repeatCount = HUGE_VALF; // repeat forever
group.animations = [NSArray arrayWithObjects:sizeAnim, alphaAnim, nil];
[ringLayer addAnimation:group forKey:nil];
https://stackoverflow.com/questions/7827638
复制相似问题