iOS6上的逐轮功能

iOS6上的逐轮功能,ios,mapkit,Ios,Mapkit,嗨,我正在尝试使用iOS6上的Mapkit获取两点之间的路线。这个想法是得到路线和地图上的覆盖。但是获得tun的唯一方法是使用地图应用程序或使用URL启动地图应用程序 无需关闭iOS6上的应用程序即可获得逐轮功能?您可以使用web视图进行此操作,并仅在UIWebView中打开safari,现在您只需为应用程序添加导航栏即可导航到应用程序 请使用以下代码: MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; regi

嗨,我正在尝试使用iOS6上的Mapkit获取两点之间的路线。这个想法是得到路线和地图上的覆盖。但是获得tun的唯一方法是使用地图应用程序或使用URL启动地图应用程序


无需关闭iOS6上的应用程序即可获得逐轮功能?

您可以使用web视图进行此操作,并仅在UIWebView中打开safari,现在您只需为应用程序添加导航栏即可导航到应用程序

请使用以下代码:

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