Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

6. Core Location and Maps > 6.5. Displaying Pins with Different Colors on a Map...

6.5. Displaying Pins with Different Colors on a Map View

Problem

The default color for pins dropped on a map view is red. You want to be able to display pins in different colors in addition to the default color.

Solution

Return instances of MKPinAnnotationView to your map view through the mapView:viewForAnnotation: delegate method.

Every annotation that is added to an instance of MKMapView has a corresponding view that gets displayed on the map view. These views are called annotation views. An annotation view is an object of type MKAnnotationView, which is a subclass of UIView. If the delegate object of a map view implements the mapView:viewForAnnotation: delegate method, the delegate object will have to return instances of the MKAnnotationView class to represent (and optionally, customize) the annotation views to be displayed on a map view.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint