ios – 如何在GMSMapView上设置自定义注释标记(围绕点的动画环)

ios – 如何在GMSMapView上设置自定义注释标记(围绕点的动画环),第1张

概述使用谷歌地图iOS SDK我已经实现了mapView 因为我已经创建了如下标记 // Creates a marker in the center of the map.GMSMarker *marker = [[GMSMarker alloc] init];marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);marker 使用谷歌地图iOS SDK我已经实现了mapVIEw
因为我已经创建了如下标记
// Creates a marker in the center of the map.GMSMarker *marker = [[GMSMarker alloc] init];marker.position = CLLocationCoordinate2DMake(-33.86,151.20);marker.Title = @"Sydney";marker.snippet = @"Australia";marker.icon = [UIImage imagenamed:@"point1.png"]; marker.map = mapVIEw_;

但我需要显示动画图像,即要显示的一些图像序列,一个点周围的动画环,而不是原始的GMSMarker

图像序列为point1.png point2.png point3.png point4.png point5.png

任何人都可以帮助我实现这一目标

解决方法 在
- (RMMapLayer *)mapVIEw:(RMMapVIEw *)mpVIEw layerForAnnotation:(RMAnnotation *)annotation{  UIImageVIEw *pulseRingimg = [[UIImageVIEw alloc] initWithFrame: CGRectMake(-30,-30,78,78)];    pulseRingimg.image = [UIImage imagenamed:@"pulseRing.png"];     pulseRingimg.userInteractionEnabled = NO;    CABasicAnimation *theAnimation;    theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale.xy"];    theAnimation.duration=2.0;    theAnimation.repeatCount=HUGE_VALF;    theAnimation.autoreverses=NO;    pulseRingimg.Alpha=0;    theAnimation.fromValue=[NSNumber numberWithfloat:0.0];    theAnimation.tovalue=[NSNumber numberWithfloat:1.0];    pulseRingimg.Alpha = 1;    [pulseRingimg.layer addAnimation:theAnimation forKey:@"pulse"];      pulseRingimg.userInteractionEnabled = NO;    [mapVIEw addSubvIEw:pulseRingimg];    [marker addSublayer:pulseRingimg.layer]; return marker;}

[UIImage imagenamed:@“pulseRing.png”]中的pulseRing.png是

参考来自:

ios – how to do a native “Pulse effect” animation on a UIButton

CABasicAnimation *theAnimation;theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];theAnimation.duration=1.0;theAnimation.repeatCount=HUGE_VALF;theAnimation.autoreverses=YES;theAnimation.fromValue=[NSNumber numberWithfloat:1.0];theAnimation.tovalue=[NSNumber numberWithfloat:0.0];[mybutton.layer addAnimation:theAnimation forKey:@"animateOpacity"];
总结

以上是内存溢出为你收集整理的ios – 如何在GMSMapView上设置自定义注释标记(围绕点的动画环)全部内容,希望文章能够帮你解决ios – 如何在GMSMapView上设置自定义注释标记(围绕点的动画环)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1105087.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存