To show the route between mutliple points in iphone sdk

孤人 提交于 2019-12-25 18:07:31

问题


I want to show the exact route path between the more that two points.

I do have some example but all are having example which show the route between two points.

Exmaple :- this, also this even i had also gone through the example of regexlite. But all have the logic for the route between two points. Through polyline i can just draw the straight line.I am not able to see the route.

EDITED QUESTION:-

There are 5 points:-

1)points is :-"lat": -35.29987329273559, "lng": 149.13395404815674,

2)Point is:- "lat": -35.2984416380826, "lng": 149.13144886493683,

3)point is:- "lat": -35.302576234486935, "lng": 149.13335928744252,

4)point is:- "lat": -35.301081642089805, "lng": 149.13073539733887,

5)point is :-"lat": -35.29991644393122, "lng": 149.13659454104746,

Now i want to draw a route from point 1 to point 5.And route must contain all the points. I know i can find the route between two points but how do i fire the one and same method again and again so find the route Please help me. Thank in advance


回答1:


Apple integrate new feature to show route.

Requirement -> OS version should be IOS6or later.

Show route from current location to YourCoordinate in iOS6

-(void)showMapRouteFromCurrentLocation
{
    CLLocationCoordinate2D currentUserCoordinate = YourCoordinate;
    //currentUserCoordinate.latitude=  +53.509980;
    //currentUserCoordinate.longitude =  -0.133700;

    MKPlacemark *place = [[MKPlacemark alloc]
                          initWithCoordinate:currentUserCoordinate
                          addressDictionary:nil];


    MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];

    NSDictionary *routeOption = [[NSDictionary alloc] initWithObjectsAndKeys:MKLaunchOptionsDirectionsModeDriving,MKLaunchOptionsDirectionsModeKey, nil];

    [mapItem openInMapsWithLaunchOptions:routeOption];
}  

Here is the link of this.



来源:https://stackoverflow.com/questions/13742305/to-show-the-route-between-mutliple-points-in-iphone-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!