Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Instead of the default iOS SDK pins, you would like to display your own images as pins on a map view.
Load an arbitrary image into an instance of the UIImage class and
assign it to the image property of
the MKAnnotationView instance that
you return to your map view as a
pin:
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id <MKAnnotation>)annotation{
MKAnnotationView *result = nil;
if ([annotation isKindOfClass:[MyAnnotation class]] == NO){
return result;
}
if ([mapView isEqual:self.myMapView] == NO){
/* We want to process this event only for the Map View
that we have created previously */
return result;
}
/* First typecast the annotation for which the Map View has
fired this delegate message */
MyAnnotation *senderAnnotation = (MyAnnotation *)annotation;
/* Using the class method we have defined in our custom
annotation class, we will attempt to get a reusable
identifier for the pin we are about to create */
NSString *pinReusab....