0

If I have many Annotation in my map view… how to understand what CallOut I've pressed? In tableview for example we have "didSelectRowAtIndexPath"... but here?

-(void)button:(id)sender {


[self performSegueWithIdentifier: @"dettaglio"sender: self];

}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

if (![[segue identifier] isEqualToString:@"dettaglio"]&&![[segue identifier]     
isEqualToString:@"cerca"])
{

[(paginaOpzioni*)segue.destinationViewController setDelegate:self];

}

if ([[segue identifier] isEqualToString:@"dettaglio"])
{
    paginaDettaglio *ibcVC = [segue destinationViewController];
    Annotazione *annotazioneDaPassare=[mapAnnotations objectAtIndex:2];
    ibcVC.immagine = annotazioneDaPassare.immagine;
    ibcVC.navigationItem.title = annotazioneDaPassare.title;
}
}

I need to change the value (2) of [mapAnnotations objectAtIndex:2]; because I want to send to the DestinationViewController the right image and text! Thanks

user1639377
  • 117
  • 1
  • 7