2013-04-27 50 views
2

我有一個位於其中的丟棄的針的地圖視圖,我想要做的是顯示從用戶當前位置到丟棄的針的路線。從當前位置導航到丟棄的針

我搜索了它,但沒有運氣,如果有人知道一個辦法做到這一點,請幫助嗎? :)

在此先感謝。

回答

1

試試吧....

你可以用兩種方式做到這一點:
1.

CLLocationCoordinate2D start = { c_lat, c_long }; 
CLLocationCoordinate2D destination = { [[dic valueForKey:@"business_lat"]doubleValue], [[dic valueForKey:@"business_long"]doubleValue] }; 

NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f&",start.latitude, start.longitude, destination.latitude, destination.longitude]; 

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]]; 

2.

使用谷歌API

請檢查this爲兩地之間劃線

在API,您只需要通過原籍名和目的地

希望我幫助....

+0

着它的MapView內完成? – aLFaRSi 2013-04-27 12:05:56

+0

@aLFaRSi:是的,您需要使用第二個選項,只需使用google api並解析響應並根據您的選擇設置數據。 – 2013-04-27 12:12:03

+0

請你可以告訴我該怎麼做? :) – aLFaRSi 2013-04-27 12:12:54

相關問題