我想在MKMapview
中获取方向路线详细信息。我在下面提到了一个示例网址。同样我想要,但不想去下一个URL。如果你知道,请任何人帮忙。是不是可能在ios中?
CLLocationCoordinate2D start = { (37.785834), (-122.406417) };
CLLocationCoordinate2D end = { (48.922499), (-125.507813) };
NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", start.latitude, start.longitude, end.latitude, end.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];
答案 0 :(得分:0)
我认为这可以帮助您从起点到终点获得路线。
在Viewcontroller.m文件中使用此代码..
- (void)viewDidLoad {
[super viewDidLoad];
MapView* mapView = [[[MapView alloc] initWithFrame:
CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)] autorelease];
[self.view addSubview:mapView];
Place* home = [[[Place alloc] init] autorelease];
home.name = @"Home";
home.description = @"Sweet home";
home.latitude = 37.785834;
home.longitude = -122.406417;
Place* office = [[[Place alloc] init] autorelease];
office.name = @"Office";
office.description = @"Bad office";
office.latitude = 48.922499;
office.longitude = -125.507813;
[mapView showRouteFrom:home to:office];
}
有关此内容的详细信息,请参阅此站点的代码。 http://code.google.com/p/ashiphone/downloads/detail?name=MapWithRoutes.zip&can=2&q=
如果你的问题得到解决,那么请随便问一下......