Gau*_*mar 6 iphone xcode objective-c ipad ios
我在点击注释时在地图中设置自定义注释引脚我得到了这个方法的调用
(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view NS_AVAILABLE(NA, 4_0)
Run Code Online (Sandbox Code Playgroud)
在那个方法中我想打开popover所以我想要帧格式(MKAnnotationView*)视图我在正常模式下映射时得到正确的帧.
但是当我缩放地图并点击那时的注释时我得到了错误的框架,那时x和y值很大,所以我得到的任何偏移或缩放因子的任何解决方案我都按照那样划分,所以我得到实际框架注释.
试试这个:
CGPoint annotationPoint = [mapView convertCoordinate:view.annotation.coordinate
toPointToView:mapView];
float boxDY = annotationPoint.y - 35;
float boxDX = annotationPoint.x - 1;
CGRect box = CGRectMake(boxDX, boxDY, 1, 1);
[popoverControllerDetail presentPopoverFromRect:box
inView:mapView
permittedArrowDirections:(UIPopoverArrowDirectionDown|
UIPopoverArrowDirectionLeft|
UIPopoverArrowDirectionRight)
animated:YES];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
821 次 |
| 最近记录: |