iPhone – How do I detect click notes PIN on a map?

I want to detect click on the annotation pin (mapkit) so that I can perform actions on the event.

Now, if I touch the annotation pin, The default comment tag will pop up. I want to customize it to call my method when I touch the pin.

You need to implement the following delegate method

(MKAnnotationView) mapView viewForAnnotation:(id) annotation

Then declare the following in this method< /p>

MKPinAnnotationView *view=[[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"abc"];
view.canShowCallout=YES;
view.calloutOffset =CGPointMake(-20,10); //As per your choice

Then you can add UI to your annotations, such as UIButton or UIImage as view.rightCalloutAccesoryView View.leftCalloutAccesoryView

div>

I want to detect click on the annotation pin (mapkit) so that I can perform actions on the event.

Now, if I touch the annotation pin, it will The default comment tag pops up. I want to customize it to call my method when the pin is touched.

You need to implement the following delegate method

(MKAnnotationView) mapView viewForAnnotation:(id) annotation

Then declare the following in this method

MKPinAnnotationView *view=[[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier: @"abc"];
view.canShowCallout=YES;
view.calloutOffset=CGPointMake(-20,10); //As per your choice

Then you can Add UI to the annotation, such as UIButton or UIImage as view.rightCalloutAccesoryView View.leftCalloutAccesoryView

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1088 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.