如何在gmsmap视图上闪烁gms标记

问题描述 投票:2回答:2

我正在使用google map,并且我已经使用了GMS Map视图。在地图视图中,我为当前位置创建了一个GMS标记,它使用当前的纬度和经度值每秒更新一次。我使用此代码:

 mMapView = [[GMSMapView alloc]init];
    mMapView.delegate = self;
    mMapView.myLocationEnabled = YES;
 mMapView.frame = CGRectMake(0, 95, self.view.frame.size.width,self.view.frame.size.height -205);

GMSMarker *disMarker = [GMSMarker markerWithPosition:coordinateEndLocation];
        disMarker.snippet = @"current Location";

        disMarker.animated = YES;
        disMarker.map = mMapView;

但是我希望该标记每秒钟闪烁一次。请告诉我我做错了什么?

ios google-maps google-maps-sdk-ios
2个回答
0
投票
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];
[yourMarker.layer addAnimation:theAnimation forKey:@"animateOpacity"];

0
投票

Swift 5.0

© www.soinside.com 2019 - 2024. All rights reserved.