Advertisement
Guest User

Untitled

a guest
Aug 6th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation {
  2.   // if it's the user location, just return nil.
  3.   if ([annotation isKindOfClass:[MKUserLocation class]]){
  4.     return nil;
  5.   }
  6.    
  7.   MKAnnotationView *pinView = [map viewForAnnotation:annotation];
  8.   PersonPin *pin = (PersonPin*)annotation;
  9.  
  10.   if (!pinView || pin.needsDisplay) {
  11.     MKAnnotationView *annotationView =
  12.       [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];
  13.  
  14.     UIImage *image;
  15.     image = [UIImage imageNamed:[pin getPinImage]];
  16.     UIImage *resizedImage = [pin sizePinToFitMap:image bounds:self.view.bounds];
  17.     annotationView.image = resizedImage;
  18.     annotationView.canShowCallout = YES;
  19.     annotationView.annotation = annotation;
  20.     annotationView.opaque = NO;
  21.     return annotationView;
  22.   } else {
  23.     pinView.annotation = annotation;
  24.   }
  25.   return pinView;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement