本文介绍了计算完成Apple Maps旅程所需的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在MKMapView上获取2个位置之间的方向.是否有任何方法可以获取完成此旅程所需的时间?是否有任何MKRoute or MKDirection
类的内置属性可以为我提供覆盖时间这次旅程?
I am working on MKMapView to get the direction between 2 locations.Is there any way i can get the time it may take in completing this journey?Is there any inbuilt property of MKRoute or MKDirection
Class that can provide me time to cover this journey ?
任何帮助将不胜感激.
谢谢维卡斯
推荐答案
是.
名为 calculateETAWithCompletionHandler:的 MKDirections 方法可能很容易忽略.
The MKDirections method named calculateETAWithCompletionHandler: can just be a bit easy to overlook, though.
一个实现可能如下所示:
An implementation could look as follows:
MKDirections *yourDirections = ...;
[yourDirections calculateETAWithCompletionHandler:^(MKETAResponse *response, NSError *error)
{
NSTimeInterval estimatedTravelTimeInSeconds = response.expectedTravelTime;
...
}];
来源:
这篇关于计算完成Apple Maps旅程所需的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!