title: multiple Mapkit annotations with showdetails how do I load details for each annotation?
body: <p>I got my map working fine with multiple annotations in an NSMuttableArray, MyAnnotations display fine with a title and subtitle and a rightcalloutbutton linked to a view with action @selector showDetails. However how do I load details for each annotation into that view? i.e if someone clicks empire state building it displays info about itself into that view, and someone clicks Chrysler building it also displays details about itself in this view.</p>
  
  <p>I have been searching for ways for sometime however i cant seem to figure it out here is a snippet of my rootviewcontroller.m</p>
  
  <p>if it helps all my annotations are named so on and so forth</p>
  
  <pre><code>[mapView addAnnotation:myAnnotation1];
  [mapView addAnnotation:myAnnotation2];
  [mapView addAnnotation:myAnnotation3];
  [mapView addAnnotation:myAnnotation4];
  </code></pre>
  
  <p>with corresponding</p>
  
  <pre><code>MyAnnotation* myAnnotation1=[[MyAnnotation alloc] init];
  
  myAnnotation1.coordinate=theCoordinate1;
  myAnnotation1.title=@"Asda";
  myAnnotation1.subtitle=@"Kimberley Way, TN240SE";
  
  
  
  - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;)annotation
  {
      NSLog(@"welcome into the map view annotation");
  
      // if it's the user location, just return nil.
      if ([annotation isKindOfClass:[MKUserLocation class]])
          return nil;
  
      // try to dequeue an existing pin view first
      static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
      MKPinAnnotationView* pinView = [[[MKPinAnnotationView alloc]
                                       initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
      pinView.animatesDrop=YES;
      pinView.canShowCallout=YES;
      pinView.pinColor=MKPinAnnotationColorPurple;
  
      //differnt colored pins based on title name
  
      if ([[annotation title] isEqualToString:@"Asda"])
  
          pinView.pinColor = MKPinAnnotationColorRed;
  
      else if ([[annotation title] isEqualToString:@"Ashford Football Club"])
  
          pinView.pinColor = MKPinAnnotationColorGreen;
  
      UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
      [rightButton setTitle:annotation.title forState:UIControlStateNormal];
      [rightButton addTarget:self
                      action:@selector(showDetails:)
            forControlEvents:UIControlEventTouchUpInside];
      pinView.rightCalloutAccessoryView = rightButton;
  
  
  
      UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"profile.png"]];
      pinView.leftCalloutAccessoryView = profileIconView;
      [profileIconView release];
  
      return pinView;
  }
  
  
  -(IBAction)showDetails:(id)sender{
  
      NSLog(@"Annotation Click");
      self.userProfileVC.title=((UIButton*)sender).currentTitle;
      [self.navigationController pushViewController:self.userProfileVC animated:YES];
  }
  - (void)dealloc {
      [super dealloc];
  }
  
  
  @end
  </code></pre>