(iOS)标注在所有区域都不可点击

时间:2015-01-20 10:41:46

标签: ios xcode mapkit

我有标记和标注视图的奇怪问题。我的标记有36x48点,但标注视图为132x61点。如果我将下面的代码添加到didSelectAnnotationView,我的标注仅在标记区域(36x48)中运行。休息标注区域没有反应。您是否有任何想法如何改进我的代码,整个区域将是可点击的?

提前致谢

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
   if(![view.annotation isKindOfClass:[MKUserLocation class]])
   {
      CalloutView *calloutView = (CalloutView *)[[[NSBundle mainBundle] loadNibNamed:@"calloutView" owner:self options:nil] objectAtIndex:0];
      CGRect calloutViewFrame  = calloutView.frame;

      calloutViewFrame.origin            = CGPointMake(-  calloutViewFrame.size.width/2+35, -calloutViewFrame.size.height + 57);
      calloutView.frame                  = calloutViewFrame;
      calloutView.userInteractionEnabled = YES;
      view.userInteractionEnabled        = YES;
      [view addSubview:calloutView];
   }
}

0 个答案:

没有答案