2

问候,

            I have a very weird but interesting requirement.

我需要的是,我的数据库中存储了一组地理点。到目前为止,我所做的是,成功检索了 lat。长对并使用默认针点将其显示在 MapView 上。每个注释都有一个从数据库派生的唯一标题和副标题。

我的要求是,当我点击一个特定的引脚时,我希望显示一个 AlertView。在该 AlertView 中将有两个按钮,1)获取方向 2)关闭。

1)获取方向。

当我单击 GetDirections 时,它应该获取相应的纬度和经度,并且我有当前的纬度和当前经度。然后,它应该打开一个 WebView 并执行此操作

- (void)getDirections {
    CLLocationCoordinate2D start = { (startLat), (startLong) };
    CLLocationCoordinate2D end = { (EndLat), (EndLong) };

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

}

我计划使用带后退按钮的 ModalViewController 在不同的视图中显示此 WebView,以便我可以导航回我的 Mapview。

如果这实际上/以编程方式可行,请告诉我。

4

0 回答 0