如何在iOS上显示信息窗口Google地图无需点击标记? [英] How to show a Info window in iOS Google maps without tapping on Marker?

查看:118
本文介绍了如何在iOS上显示信息窗口Google地图无需点击标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS开发新手。这是关于Google Maps iOS SDK中的标记信息窗口。



据我所知,我们可以使用GMSMarkerOption创建一个带有信息窗口的标记。

  GMSMarkerOption * myLocationOption = [GMSMarkerOption alloc]; 
myLocationOption .title = @我的位置;
myLocationOption .snippet = @Lat:....,Lang:....;

[mapView addMarkerOption:myLocationOption];

根据上述代码,Marker按照预期显示在地图视图中。
点击标记会在Google地图上显示我的位置信息窗口,这很好。

无论如何,我们可以以编程方式显示信息窗口GMSMarkerOptions * myLocationOptions = [GMSMarkerOptions options];用户转到Custom Map Screen?


myLocationOptions.title = @我的位置;
myLocationOptions.snippet = @Lat:....,Lang:....;

mapView.selectedMarker = [mapView addMarkerWithOptions:myLocationOptions];

(请注意,它是选项,而不是选项)


I am new to iOS development. This is regarding Marker info window in Google Maps iOS SDK.

I understand, we can create a marker with info window using GMSMarkerOption.

GMSMarkerOption *myLocationOption = [GMSMarkerOption alloc];
myLocationOption .title = @"My Location";
myLocationOption .snippet = @"Lat:...., Lang:....";

[mapView addMarkerOption:myLocationOption];

As per the above code, Marker displayed in the Map View as expected. And tapping on marker shows the "My Location" info window in Google maps which is good.

Is there anyway we can show the info window programmatically when the user goes to Custom Map Screen?

解决方案

GMSMarkerOptions *myLocationOptions = [GMSMarkerOptions options];
myLocationOptions.title = @"My Location";
myLocationOptions.snippet = @"Lat:...., Lang:....";

mapView.selectedMarker = [mapView addMarkerWithOptions:myLocationOptions];

(note that it's Options, not Option)

这篇关于如何在iOS上显示信息窗口Google地图无需点击标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆