Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a Info window in iOS Google maps without tapping on Marker?

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?

like image 789
albeee Avatar asked Apr 04 '13 16:04

albeee


People also ask

What is the marker on Google Maps called?

The Google Maps pin is the inverted-drop-shaped icon that marks locations in Google Maps. The pin is protected under a U.S. design patent as "teardrop-shaped marker icon including a shadow". Google has used the pin in various graphics, games, and promotional materials.

How do I remove a marker from Google Maps on Iphone?

You can remove a marker from the map by setting the map property of the GMSMarker to nil . Alternatively, you can remove all of the overlays (including markers) currently on the map by calling the GMSMapView clear method.

How do I add a marker to Google Maps on Iphone?

Type the name of a location or address. This displays a list of matching search results from Google Maps below the search bar at the top. Alternatively, you can tap the blue plus (+) icon in the lower-right corner of the map. Then tap Add new point. Drag the marker on the map to where you want to add a marker.


2 Answers

This has changed on Google Maps SDK and it's easier to understand:

GMSMarker *marker = [[GMSMarker alloc] init]; marker.position = coordinate; marker.title = @"Location selected"; marker.snippet = @"Testing"; marker.map = mapView_;  //Show info window on map [mapView_ setSelectedMarker:marker]; 

You use now setSelectedMarker method to show an info window of a marker

like image 147
estemendoza Avatar answered Sep 28 '22 08:09

estemendoza


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

(note that it's Options, not Option)

like image 45
Rikkles Avatar answered Sep 28 '22 07:09

Rikkles