xcodeannotationsmapkitcallouts

Open a view when calloutAccessoryControlTapped triggered


How can I open a view when I clicked on annotation's button with a navigation button to go back to my mapkit and pass some parameters to the view?

Regards


Solution

  • I have found a solution. Inside:

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
    

    Add:

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [btn addTarget:self action:@selector(pinTouched:) forControlEvents:UIControlEventTouchUpInside];
    

    Then have a function to open the desired view:

    -(void)pinTouched:(UIButton *)sender
    {
    myView.transform  = CGAffineTransformMakeScale(.01, .01);
    [self.view addSubview:myView];
    }