1
我想做一個自定義的輪到界面。所以我需要每一步的位置來實時計算距離。但似乎iOS7 Directions API不會在響應中公開位置。MKRouteStep:位置在哪裏?
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(@"---------------------------------------------------------------------------------");
}
}];