【问题标题】:Opening Location with Maps and marker pin使用地图和标记别针打开位置
【发布时间】:2016-01-13 07:54:41
【问题描述】:

我想用修改后的标记和详细信息打开我的纬度和经度值。所以我需要检查是否安装了谷歌地图应用程序,我需要打开它,否则我将导航到苹果地图。

这里我无法使用以下代码添加自定义引脚,

        NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"maps.apple.com/?z=12&q=%f,%f",[latitude floatValue],[longitude floatValue]]];

        if (![[UIApplication sharedApplication] canOpenURL:url]) {
            NSLog(@"Google Maps app is not installed");
            //left as an exercise for the reader: open the Google Maps mobile website instead!
            MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:rdOfficeLocation addressDictionary:nil];

            MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];

            item.name = [NSString stringWithFormat:@"%@",[[mDataArray1 objectAtIndex:indexPath.row] valueForKey:@"NAME"]];
            item.phoneNumber = [NSString stringWithFormat:@"%@",[[mDataArray1 objectAtIndex:indexPath.row] valueForKey:@"DESTINATION"]];
            [item openInMapsWithLaunchOptions:nil];

        } else {

            [[UIApplication sharedApplication] openURL:url];

        }

所以请帮我为苹果和谷歌地图添加自定义引脚值。

【问题讨论】:

    标签: objective-c google-maps mapkit xcode7 ios9.1


    【解决方案1】:

    您可以在官方文档中查看如何添加custom marker。但是,这仅适用于 Google Maps 而不是 Apple Maps(在这种情况下,您需要一个不同的库)

    【讨论】:

      猜你喜欢
      • 2011-08-15
      • 1970-01-01
      • 2018-02-20
      • 1970-01-01
      • 2011-04-27
      • 1970-01-01
      • 2015-10-18
      • 2020-06-02
      • 1970-01-01
      相关资源
      最近更新 更多