0

我想在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]];
4

1 回答 1

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=

如果您的问题得到解决,那很好,否则请随时询问..

于 2013-05-06T07:22:21.460 回答