简体   繁体   中英

Mapview touch is not getting detected in ios

I have a mapview in my xib.

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    NSLog(@"Touch Description %@",[[touch view]description]);
    if ([touch view]  == self.mapView) 
   {
      //rest of my code
   }
}

The description that I get is

MKAnnotationContainerView: 0x19057360; frame = (0 0; 4096 4096); autoresizesSubviews = NO; layer = CALayer: 0x1900df20

The if Loop is not being executed. How can I solve this. Please help me.

    -(void) touchesBegan :(NSSet *) touches withEvent:(UIEvent *)event
    {
        UITouch *touch = [touches anyObject];
        NSLog(@"%@",[[touch view]description]);
        if ([touch view]  == self.mapView) 
       {
           //rest of my code
       }

       [super touchesBegan:touches withEvent:event ];
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM