MKAnnotationView框架不正确

时间:2013-10-23 09:25:11

标签: ios ipad mkmapview mapkit mkannotationview

我有这样的方法:

   - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIButton *)control
    {

            UIStoryboard *Mystoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
            CTObjectCreationVC *content = [Mystoryboard instantiateViewControllerWithIdentifier:TEST];
            content.modalInPopover = YES;

            content.contentSizeForViewInPopover = CGSizeMake(500, 300);
            self.myPopoverController = [[UIPopoverController alloc] initWithContentViewController:content];
            [self.myPopoverController presentPopoverFromRect:control.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown animated:YES];
    }

我需要获取框架(MKAnnotationView *)view才能显示我的Popover。但我有这样一个非常奇怪的框架:

  

MKPinAnnotationView:0x1c600800; frame =(633571 327938; 32 39); tag =   3;

为什么呢?为什么X和Y非常大?如何获得真正的X和Y?感谢

记录

  

2013-10-23 14:05:52.794 view frame:MKPinAnnotationView:0x1f8c2160;   frame =(633548 328139; 32 39); tag = 17; gestureRecognizers =   NSArray:0x1f8c2490&gt ;; layer = MKLayer:0x1f8c21c0>>可见:1   +55.68109131,+ 37.51455307

1 个答案:

答案 0 :(得分:0)

我猜你在调用代表之前得到了这个框架,

NSLog放入此方法并检查其框架是什么。

   - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIButton *)control
    {
         NSLog("view frame:%@",view);
    }