How to change the proximity of which a userLocation annotation
generates.
I'm talking about the faded blue circle the userLocation annotation
is creating around it. How can I change it's radius?
Asked
Active
Viewed 74 times
0

Chaudhry Talha
- 7,231
- 11
- 67
- 116
1 Answers
1
Take a look at: https://github.com/TransitApp/SVPulsingAnnotationView
Add following files from Library:
SVAnnotation.h
SVAnnotation.m
SVPulsingAnnotationView.h
SVPulsingAnnotationView.m
Import:
#import "SVAnnotation.h"
#import "SVPulsingAnnotationView.h"
Using SVPulsingAnnotationView
you can set pulseScaleFactor
property to change radius,use below code in viewForAnnotation
method when you found UserLocation:
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;

Ronak Chaniyara
- 5,335
- 3
- 24
- 51
-
will it be intractable? Like when the proximity will hit an annotation it'll do something? – Chaudhry Talha Jul 18 '16 at 12:48
-
yes, as it implements `@interface SVPulsingAnnotationView : MKAnnotationView`@Talha Ch – Ronak Chaniyara Jul 18 '16 at 12:52
-
I implemented it as you said first of all I used pods to include this library. Then it showed me error that this is not found `#import "SVAnnotation.h"` after that in the code `pulseScaleFactor` is not found. What to do? – Chaudhry Talha Jul 19 '16 at 12:53
-
I found this https://github.com/phunware/maas-mapping-ios-sdk based on the search for `pulseScaleFactor` will it work? – Chaudhry Talha Jul 19 '16 at 13:20
-
`SVAnnotation.h` and `SVAnnotation.m` will be in library at above given link and you have to add it into your project@TalhaCh – Ronak Chaniyara Jul 19 '16 at 13:36
-
I've figured out the way to increase the pulse scale factor and I'm close to what I want to achieve. I did it without importing `SVAnnotation.h` and with only `SVPulsingAnnotationView.h`. But there is one thing I can't find so can you edit your answer and show me that if I've added a custom annotation and if the pulse hits it it'll do something like show an alert or something. – Chaudhry Talha Jul 20 '16 at 09:37
-
can you answer it here http://stackoverflow.com/questions/38479964/annotations-get-pop-up-when-user-is-near-them – Chaudhry Talha Jul 20 '16 at 11:36
-
i can't figure it out, but you can check [https://www.reddit.com/r/iOSProgramming/comments/32piou/mapkit_annotations_closing_on_didupdatelocation/](https://www.reddit.com/r/iOSProgramming/comments/32piou/mapkit_annotations_closing_on_didupdatelocation/) it may help@TalhaCh – Ronak Chaniyara Jul 20 '16 at 11:45