我的方法是这样的: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
。但我有这样非常奇怪的框架:
MKPinAnnotationView:0x1c600800; frame =(633571 327938; 32 39); tag = 3;
为什么?为什么X和Y很大?如何获得真正的X和Y?感谢
登录
2013年10月23日14:05:52.794视图帧:MKPinAnnotationView:0x1f8c2160; frame =(633548 328139; 32 39); tag = 17; gestureRecognizers = NSArray:0x1f8c2490>;层= MKLayer:0x1f8c21c0 >>可见:1 55.68109131,37.51455307
您是否尝试在'NSLog'中打印帧?在这个方法中。 –
我在日志中添加了日志 – Alexander
我不确定你在哪里以及如何正确记录,但请注意,可以使用传递给委托方法的MKAnnotationView'view'参数完成presentPopoverFromRect(而不是使用'self.view'这大概是父vc)。有关示例,请参阅http://stackoverflow.com/questions/5582564/how-do-i-display-a-uipopoverview-as-a-annotation-to-the-map-view-ipad/5583505#5583505。 – Anna