title: How Do I Add Custom Button/MapPin to MKAnnotation?
body: <p>I'm a noob to iphone development and i'm trying to add a custom button to an annotation callout.  I have no problems adding a regular button to rightCalloutAccessoryView, but it's just not working for custom style.  My image size is 32 x 32. I also want to add a custom map pin following this stackoverflow question <a href="https://stackoverflow.com/questions/2699171/how-do-i-add-custom-pins-to-the-iphone-mapkit">here</a> Any help is greatly appreciated.</p>
  
  <p>MY CODE</p>
  
  <pre><code>-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;)annotation {
  // Define your reuse identifier.
  static NSString *identifier = @"MapPoint";   
  
  if ([annotation isKindOfClass:[MapPoint class]]) {
      MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
      if (annotationView == nil) {
          annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
      } else {
          annotationView.annotation = annotation;
      }
      annotationView.enabled = YES;
      annotationView.canShowCallout = YES;
      annotationView.animatesDrop = YES;
      annotationView.image = [UIImage imageNamed:@"myimage.png"];
  
      UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
      //UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
      [rightButton setImage:[UIImage imageNamed:@"phony2.png"] forState:UIControlStateNormal];
      [rightButton addTarget:self
                      action:@selector(showDetails:)
            forControlEvents:UIControlEventTouchUpInside];
      annotationView.rightCalloutAccessoryView = rightButton;
  
      return annotationView;
  }
  return nil;    
  </code></pre>
  
  <p>}</p>