This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: Objective C  |  size: 0.94 KB  |  views: 61  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data