Calculate distance of MKPolyline path?

家住魔仙堡 提交于 2020-01-01 03:39:07

问题


I would like to get the meters of a MKPolyline path so I can tell the user what are the meters left to finish the path.

I've been searching for something to do it but I couldn't get anything.

Thanks.


回答1:


As tedious as it sounds, unless you want to do the maths yourself you're probably going to have to iterate thought the line's points, convert each to a CLLocation and use its -distanceFromLocation: between each, summing up to the appropriate total.



来源:https://stackoverflow.com/questions/14789706/calculate-distance-of-mkpolyline-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!