计算完成Apple Maps旅程所需的时间 [英] calculate time taken to cover a journey in Apple Maps

查看:98
本文介绍了计算完成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;
     ...
}];

来源:

https://developer .apple.com/library/mac/documentation/MapKit/Reference/MKDirections_class/Reference/Reference.html

这篇关于计算完成Apple Maps旅程所需的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆