计算MKPolyline路径的距离? [英] Calculate distance of MKPolyline path?
本文介绍了计算MKPolyline路径的距离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想得到MKPolyline路径的米,这样我就可以告诉用户完成路径的剩余米数。
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.
谢谢。
推荐答案
听起来很乏味,除非你想自己做数学,否则你可能需要迭代思考该行的点
,将每个转换为a CLLocation
并在每个之间使用 -distanceFromLocation:
,总计相应的总数。
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.
这篇关于计算MKPolyline路径的距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文