【问题标题】:MKRouteStep: Where is the location?MKRouteStep:地点在哪里?
【发布时间】:2014-02-02 14:05:08
【问题描述】:

我想制作一个自定义的轮流界面。因此我需要每一步的位置来实时计算距离。但似乎 iOS7 Directions API 没有在响应中公开位置。

MKDirections *directions = [[MKDirections alloc] initWithRequest:directionsRequest];
[directions calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) {


    MKRoute *firstRoute = response.routes[0];
    NSArray *steps = firstRoute.steps;
    for (MKRouteStep *step in steps) {
        NSLog(@"---------------------------------------------------------------------------------");
        NSLog(@"instruction %@", step.instructions);
        NSLog(@"notice %@", step.notice);
        NSLog(@"distance %f", step.distance);
        NSLog(@"---------------------------------------------------------------------------------");
    }
}];

【问题讨论】:

    标签: ios map routing navigation mapkit


    【解决方案1】:

    试试这段代码找出每一步的位置:

    step.polyline.coordinate
    

    另外,response参数中还有路由的来源和目的地。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-29
      • 1970-01-01
      相关资源
      最近更新 更多