Here is code to handle tap gesture on map view and display data related to that when click on pin its directly display its related data.
///Add protocol for UIGestureRecognizerDelegate
///Add on each pin in viewForAnnotation
UITapGestureRecognizer *pinTap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pinTapped:)];
pinTap.numberOfTapsRequired=1;
[yourPinView addGestureRecognizer:pinTap];
///Gesture Handle method
- (void)pinTapped:(UIGestureRecognizer *)gestureRecognizer
{
NSLog(@"%i",[gestureRecognizer view].tag);
NSLog(@"Write your code");
}
No comments:
Post a Comment