2012-11-03 4 views
0

안녕하세요, iOS6에서 Mapkit을 사용하여 2 점 사이의 경로를 찾으려고합니다. 아이디어는지도에서 경로와 오버레이를 얻는 것입니다. 그러나 Turn by Turn을 얻는 유일한 방법은지도 애플리케이션을 사용하거나 URL이있는지도 애플리케이션을 실행하는 것입니다.iOS6의 턴 기능으로 돌아 가기

iOS6에서 앱을 닫지 않고 Turn by turn 기능을 사용할 수 있습니까?

답변

0

UIWebView에서만 웹보기를 사용하고 사파리를 열 수 있습니다. 이제 네비게이션 막대를 추가하여 앱을 탐색 할 수 있습니다. 그것을위한 코드 아래

사용 :

MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; 
    region.center.latitude = getLatitude; 
    region.center.longitude = getLongitude; 

    MKCoordinateRegion currentRegion = { {0.0, 0.0 }, { 0.0, 0.0 } }; 
    currentRegion.center.latitude = currentLatitude; 
    currentRegion.center.longitude = currentLongitude; 
    region.span.longitudeDelta = 4.0f; 
    region.span.latitudeDelta = 4.0f; 
    currentRegion.span.longitudeDelta = 4.0f; 
    currentRegion.span.latitudeDelta = 4.0f; 

    CLLocationCoordinate2D start = { currentRegion.center.latitude, currentRegion.center.longitude }; 
    CLLocationCoordinate2D destination = { region.center.latitude, region.center.longitude }; 


    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]; 

    NSURL *url=[NSURL URLWithString:googleMapsURLString]; 
    NSURLRequest *requestObj=[NSURLRequest requestWithURL:url]; 
    [webView loadRequest:requestObj]; 
+0

당신이 그것을위한 몇 가지 예제 코드를 줄 수 있습니까? –

+0

OK @MR. 17 또한 코드를 추가했습니다. – Ashutosh