write this method in .m file
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString: @"MapToDeal"])
{
DetailViewController *detailViewController = [segue destinationViewController];
detailViewController.annotview = sender; //here annoteview is object in DetailViewcontroller
}
}
or
you can also do like this
In mapView Delegate method
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
[self performSegueWithIdentifier:@"MapToDeal" sender:view];
}
In prepareForSegue:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([[segue identifier] isEqualToString:@"MapToDeal"])
{
MapPoint *annotation = (MapPoint *)view.annotation;
DetailViewController *dvc = segue.destinationViewController;
dvc.name = annotation.name;
dvc.anyproperty = annotation.anyproperty;
}
}