如何在iphone中获取gmsmapview的坐标中心 [英] How to get coordinate center of gmsmapview in iphone
问题描述
我正在使用适用于iOS的新版Google Maps SDK
I'm using the new Google Maps SDK for iOS
我可以从GMSMapView.center获取真正的坐标吗?
现在它返回一个CGPoint值,但它不是真正的坐标。
Can I get the true coordinate form GMSMapView.center? Now it returns a value of CGPoint, but it's not the true coordinate.
感谢和问候。
推荐答案
我建议使用 [yourMapView.camera target]
而不是Jing的解决方案。
I suggest to use [yourMapView.camera target]
instead of Jing's solution.
Jing的解决方案在iOS 6上运行正常,但可能在iOS 7 / 7.1上有问题,
投影可能报告错误的坐标(有点向下移位)!
我检查了地图边界和填充是否正确,结果是 [projection pointForCoordinate:coordinate]
和 [projection coordinateForPoint:point]
可以相互对比,没有问题在哪里......
Jing's solution work fine on iOS 6, but maybe having issue on iOS 7/7.1,
the projection may report wrong coordinate (a bit downward shift) !
I have checked the map bounds and padding is correct, both result of [projection pointForCoordinate: coordinate]
and [projection coordinateForPoint:point]
can contrast to each other, no ideas where the problem is...
这篇关于如何在iphone中获取gmsmapview的坐标中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!