ios - 谷歌地图上的标记标题

标签 ios objective-c google-maps gmsmapview

当前场景 我需要一个关于谷歌地图的解决方案,目前我能够通过 url 和 sdk 打开谷歌地图我想在我通过浏览器打开它的同时在谷歌地图的标记上填充标题。

NSString *url = [[NSString alloc]initWithFormat:@"http://maps.googleapis.com/maps/api/geocode/xml?address=%@+%@+%@",road_Str,pin_Str,city_Str];
    NSLog(@"str%@",url);
        CLLocationCoordinate2D rdOfficeLocation = CLLocationCoordinate2DMake([[latArr objectAtIndex:0] doubleValue], [[lngArr objectAtIndex:0] doubleValue]);
        NSString *str = [NSString stringWithFormat:@"comgooglemaps://?q=%@,%@,%@&center=%f,%f",road_Str,city_Str,pin_Str,rdOfficeLocation.latitude,rdOfficeLocation.longitude];
        NSURL *url = [NSURL URLWithString:str];

最佳答案

标记在坐标 (10,20) 处创建,并在单击时在信息窗口中显示字符串“Hello world”。

CLLocationCoordinate2D position = CLLocationCoordinate2DMake(10, 20);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hello World";
marker.map = mapView_;

关于ios - 谷歌地图上的标记标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37857056/

相关文章:

android - Google Play 服务位置 API 和 Google map 地理编码 API 之间有什么区别

iPhone viewWillAppear 不触发

ios - Corner by UIBezierPath for flexible View (View can be increase width height by content)

ios - 使用键关联两个不同的 NSDictionaries

javascript - 如何添加“前往”按钮并通过手机打开谷歌地图

c# - Xamarin Forms - 谷歌地图在 map 上显示多个标记

iOS 6 自定义 URL 方案启动图像错误

ios - 是否保存了 Core Data 模型图 View ?

objective-c - Xcode 6 在编译时自动添加不受支持的权利

objective-c - 导致 OS X 粘贴板崩溃