在ios中未检测到Mapview touch

时间:2012-10-09 03:48:09

标签: iphone objective-c ios uitouch

我的xib中有一个mapview。

-(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
   }
}

我得到的描述是

  

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

if循环未执行。我该怎么解决这个问题。请帮帮我。

1 个答案:

答案 0 :(得分:0)

    -(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 ];
    }