MKMapView centerCoordinate不精确

编程入门 行业动态 更新时间:2024-10-21 20:39:07
本文介绍了MKMapView centerCoordinate不精确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我尝试使用 MKMapView的centerCoordinate 将图钉放置在地图中心时,它会在图钉的大致中心位置放置一个图钉,但它在地图真实中心的南数个像素处.

When I try to place a pin in the center of the map using MKMapView's centerCoordinate it puts a pin roughly in the center, but it's several pixels south of the true center of the map.

我尝试将地图的中心点转换为坐标 MKMapView.convertPoint(MKMapView.center),该功能在ios8上运行良好,但在ios7上仍处于关闭状态(现在位于真实中心的南面和西面).

I tried converting the map's center point to a coordinate MKMapView.convertPoint(MKMapView.center) and that worked perfectly on ios8 but on ios7 is still off (now its south and west of the true center).

任何人都知道如何确定中心坐标的偏离"程度,以便我进行调整吗?

Anyone know how to determine how "off" the center coordinate is so I can adjust?

我需要这个,因为我要在地图上放置一个十字准线图像,并且需要将图钉显示在十字准线的中心.我已经用标尺验证了十字准线在地图上居中,这是固定的针脚.

I need this because I am placing a crosshair image over the map and need the pin to appear in the center of the crosshair. I've verified with a ruler that the crosshair is centered on the map, it's the pin that is off.

推荐答案

我还是不知道为什么在iOS7中MKMapView.convertPoint(MKMapView.center)与MKMapView.centerCoordinate不同,但是确实弄清楚了为什么.centerCoordinate被关闭了

Well I still don't know why in iOS7 MKMapView.convertPoint(MKMapView.center) differs from MKMapView.centerCoordinate, but did figure out why .centerCoordinate was off.

地图的一部分在状态栏下,我根据可见部分确定中心,并叠加以可见部分为中心的图像,但地图基于整个地图计算中心.因此,一旦我修复了地图无法在状态栏下运行的情况.centerCoordinate可以运行,并且在iOS7上比MKMapView.center更好.

Part of the map was under the status bar and I ruled the center based on the visible part and overlaying images centered on the visible part, but the map computed center based on the whole map. So once I fixed the map not running under the status bar .centerCoordinate works and, on iOS7, works better than MKMapView.center.

更多推荐

MKMapView centerCoordinate不精确

本文发布于:2023-11-27 04:22:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636575.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不精确   MKMapView   centerCoordinate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!