如何在iPhone应用程序中找到两个位置之间的方向? [英] How to find direction between two location in iPhone application?
本文介绍了如何在iPhone应用程序中找到两个位置之间的方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用iOS框架在两个位置之间找到方向,但是我找不到合适的解决方案.
I am trying to find direction between two location using iOS framework but I am not able to find proper solution .
推荐答案
您可以使用不同的方法来查找两个位置之间的方向.
You can use different methods for finding the direction between two location.
(1)使用Google Maps
(1) Using Google Maps
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", currentLatitude, currentLongitude, destinationLatitude, destinationLongitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
(2)使用Apple Maps:
(2) Using Apple Maps:
NSString *urlString = [NSString stringWithFormat:@"http://maps.apple.com/maps?saddr=%f,%f&daddr=%f,%f", currentLatitude, currentLongitude, destinationLatitude, destinationLongitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
如果您需要任何帮助,请告诉我.
Please let me know if you need any help.
这篇关于如何在iPhone应用程序中找到两个位置之间的方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文