0

I have a tracing tool, which checks whether the car reaches some predefined locations.

Currently, when the car reaches location, I use MKPointAnnotation and add a pin at that location. However, I don't want pin. I want a dot.

Is there a way to achieve it? Below is the code that adds pin.

- (void) addPin:(NSArray *)locations
 {
     self.location = [locations lastObject];
     self.locationCoordinate2D = self.location.coordinate;
     MKPointAnnotation *newAnnotation = [[MKPointAnnotation alloc]init];
     newAnnotation.coordinate = self.locationCoordinate2D;
     [mapView addAnnotation:newAnnotation];
 }

Thanks in advance.

user2734323
  • 706
  • 1
  • 8
  • 19

1 Answers1

0

The MKUserLocationView class which provides the dot that you see for your current location cannot be initialised without using private APIs, but you may be interested in SVPulsingAnnotationView, an open-source replica of this class that you could customise to your taste.

If this is not what you are looking for, you can draw a custom annotation yourself using CoreGraphics by subclassing MKAnnotationView. Alternatively, you can use the image property of a MKAnnotationView to use a custom image for the annotation. You may also find the iOS documentation for creating custom annotations on maps useful.

shearnonsense
  • 486
  • 3
  • 15
  • It isn't the blue pin for current location. These pins are added by me using MKPointAnnotation. I am able to add "n" number of pins. But, I want to replace pins with dots. – user2734323 Sep 01 '13 at 18:53
  • OK, I considered the current location annotation to look like a dot. I've updated my answer. – shearnonsense Sep 01 '13 at 21:25