views:

343

answers:

1

Currently, I'm developing an application, in which I have to show an infoWindow on click event on map itself.

My question is I want to show a button as well as a combobox on this infoWindow. How can I do this?

+1  A: 

You need to add a custom UIView to your MKMapView and supress the default MKAnnotation callout view. Your custom UIView can include the controls you want in the callout.

You might find the following useful:

I don't think either of these posts describe a definitive, clean solution to your problem (scrolling problem with the subview position). I suggest you re-think your UI and consider pushing an entirely new view from the standard callout right disclosure button. I feel like customizing the callout (infoWindow equivalent) doesn't translate well to the iPhone platform.

Edit:

Ok. So all you want to know is how to show a check box in an infoWindow using the regular Google Maps Javascript API?

That is a much easier question. If you have a look at the GMarker openInfoWindow, you will find that the first paramter to this method is a string. This string needs to be populated with the HTML that you would like in your infoWindow. So for your checkbox and button you need an input element of type checkbox and button:

<input type="checkbox" name="vehicle" value="Airplane" />
<input type="button" value="Blah" />
Cannonade
Cannonade, basically I'm using HTML and javascripts to develop this app. So I'm not using MKAnnotation, mapView etc. So there's no callout view here. I've to use infoWindow only.
neha
I tried this. My snippet goes as map.openInfoWindow(myGeographicCoordinates,<input type="checkbox" name="vehicle" value="Airplane" />);myGeographicCoordinates are the touch locations I'm detecting.How am I suppose to render the information in these tags? Single quotes, double quotes, will only have this statement as a string. And assigning this string to a variable again will take this as a string. Thanx in advance.
neha
You need to escape the quotes with a backslash.map.openInfoWindow(myGeographicCoordinates,"<input type=\"checkbox\" name=\"vehicle\" value=\"Airplane\" />");
Cannonade
Thank you so much for you patience, Cannonade.. It worked.
neha
@neha very glad to hear it :)
Cannonade