title: pushing image linked to specific annotation to detail view controller from map annotation detail disclosure button
body: <p>I found out how to push titles and subtitles to DVcontroller but not  pictures. I would like to push annotations specific pictures to a new DV when detail disclosure button is tapped. (using Xcode5)</p>
  
  <p>I have the storyboard setup with 2 VC and the first one is embeded in a Nav Controller. The pins show on the map (NSMutable array) and the callout comes up with detail disclosure button on the right (and one on the left as well for future use). The segue from the detail disclosure button works as I can see a blue background screen on the DVcontroller upon tapping it. I have imported pictures files and associated them to each annotation.</p>
  
  <p>I believe the answer is in the "calloutAccessoryControlTapped" method. I tried several codes in that method but still cannot return a picture in the DVcontroller.</p>
  
  <p>ViewController.m is as follows:</p>
  
  <p>(each annotation is set up like this):</p>
  
  <pre><code>//Chateau l'Evesque annotation
  myAnn = [[myAnnotation alloc] init];
  location.latitude = CLEVESQUE_LATITUDE;
  location.longitude = CLEVESQUE_LONGITUDE;
  myAnn.coordinate = location;
  myAnn.title = @"Château l'Evesque";
  myAnn.imageView=[UIImage imageNamed:@"Château l'Evesque"];
  [locations addObject:myAnn];
  </code></pre>
  
  <p>(then viewForAnnotation method):</p>
  
  <pre><code>- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: 
         (id&lt;MKAnnotation&gt;)annotation
   {
  
  
  
  if([annotation isKindOfClass: [MKUserLocation class]]) return nil;
  
  static NSString *reuseId = @"myAnn";
  
  MKAnnotationView *customAnnotationView = [mapView
  dequeueReusableAnnotationViewWithIdentifier:reuseId];
  if (customAnnotationView == nil)
  
  {
  myAnnotation *myAnn = (myAnnotation *)annotation;
  }
  
  
  MKPinAnnotationView *Mypin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation 
  reuseIdentifier:@"current"];
  Mypin.pinColor = MKPinAnnotationColorPurple;
  
  UIButton *directionButton = [UIButton buttonWithType:UIButtonTypeCustom];
  directionButton.frame = CGRectMake(0, 0, 23, 23);
  [directionButton setBackgroundImage:[UIImage imageNamed:@"PetitVolant.png"]
  forState:UIControlStateNormal];
  
  
  
  UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
  
  Mypin.leftCalloutAccessoryView = directionButton;
  Mypin.rightCalloutAccessoryView = infoButton;
  Mypin.draggable = NO;
  Mypin.highlighted = YES;
  Mypin.animatesDrop = TRUE;
  Mypin.canShowCallout = YES;
  
  return Mypin;
  }
  </code></pre>
  
  <p>(then the culprit):</p>
  
  <pre><code>- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view 
  calloutAccessoryControlTapped:(UIControl *)control
  
  {
  myAnnotation *myAnn = (myAnnotation *)view.annotation;
  NSLog(@"myAnn.imageView = %@",myAnn.imageView);
  
  
  [self performSegueWithIdentifier:@"ShowPhotoSegue" sender:self];
  
  }
  </code></pre>
  
  <p>(I greened out the "prepareForSegue" method because it is not changing anything to the result so far.)</p>
  
  <p>I rewrote the whole thing. Still the same problem. I am going to try to better explain the issue. I just want to push a picture (.png file) to the next view controller. I only get a blank (white) screen on the Detail VC after tapping the detail disclosure button. </p>
  
  <p>If I include the following <code>prepareForSegue</code> method (as described in the suggested post): </p>
  
  <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      if ([segue.identifier isEqualToString:@"ToDetail"])
      {
          MKAnnotationView *annotationView = sender;
         [segue.destinationViewController setAnnotation:annotationView.annotation];
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>GuideDesVinsCPA[2523:70b] myAnn.imageForMyAnnotation = &lt;UIImage: 0x9a4f510&gt;
  GuideDesVinsCPA[2523:70b] -[MapViewController annotation]: unrecognized selector sent to instance 0x9f31970
  GuideDesVinsCPA[2523:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MapViewController annotation]: unrecognized selector sent to instance 0x9f31970'
  </code></pre>