This question already has an answer here:
How to Increase the Radius of userLocation Annotation in Mapkit
                                
                                    (1个答案)
                                
                        
                                3年前关闭。
            
                    
如何更改userLocation annotation生成的接近度。
ios - 如何更改用户位置注释的接近度-LMLPHP我说的是userLocation annotation在其周围创建的褪色蓝色圆圈。如何更改半径?

最佳答案

看一下:https://github.com/TransitApp/SVPulsingAnnotationView

从库中添加以下文件:

SVAnnotation.h
SVAnnotation.m

SVPulsingAnnotationView.h
SVPulsingAnnotationView.m


进口:

#import "SVAnnotation.h"
#import "SVPulsingAnnotationView.h"


使用SVPulsingAnnotationView可以设置pulseScaleFactor属性以更改半径,当找到UserLocation时在viewForAnnotation方法中使用以下代码:

        static NSString *identifier = @"currentLocation";
        SVPulsingAnnotationView *pulsingView = (SVPulsingAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];

        if(pulsingView == nil) {
            pulsingView = [[SVPulsingAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
            pulsingView.annotationColor = [UIColor colorWithRed:0.678431 green:0 blue:0 alpha:1];
            pulsingView.pulseScaleFactor=7.0;//Change pulseScaleFactor as required
            pulsingView.canShowCallout = YES;
        }

        return pulsingView;

10-04 23:07