4

Well i have a question? Im Confuse!

I have a mapview where the annotations are layed out.Now i want a popover for annotations.

how Should i do it

1.Create a popover controller in storyboard and push it from delgate method. 2.Create a programmatic popover view ,by all sub views and stuff?

I want to use the first method any one help me out.

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control

{ // UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"annotationPopUp"]; [self performSegueWithIdentifier: @"annotationPush" sender:nil]; }

Dheeraj Kaveti
  • 309
  • 1
  • 2
  • 9

1 Answers1

3

In mapView:didSelectAnnotationView make your popover (preferably a property) in your class and pressent it. Here's a example:

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    self.popover = [[UIPopoverController alloc] initWithContentViewController:yourViewController];

    [self.popover presentPopoverFromRect:view.bounds 
                                  inView:view   
                permittedArrowDirections:UIPopoverArrowDirectionAny 
                                animated:YES];
}
Yuliani Noriega
  • 1,085
  • 12
  • 23