问题
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