繁体   English   中英

iOS6上的转弯功能

[英]Turn by turn feature on iOS6

嗨,我正在尝试使用iOS6上的Mapkit获得2点之间的路线。 想法是获取路线并在地图上叠加。 但是,通过tun获取转弯的唯一方法是使用地图应用程序或使用URL启动地图应用程序。

无需关闭iOS6上的应用程序即可获得“转弯”功能吗?

您可以为此使用网络视图,并仅在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];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM