Clickable pins?

2 views
Skip to first unread message

MrXino

unread,
Jan 9, 2009, 3:29:30 AM1/9/09
to iphone-map-view
Does anybody has an idea about changing the code so pins can be opened
(so additional information can be viewed)? For example a map like
this: http://code.google.com/intl/nl/apis/maps/documentation/examples/icon-custom.html

ChaF

unread,
Jan 23, 2009, 5:10:56 AM1/23/09
to iphone-map-view
Hi,

I made some try to obtain clickable markers.
First, I try to add an information window

NSString *script =
[NSString stringWithFormat:
@"var point = new GLatLng(%f, %f);"
"var marker = new GMarker(point);"
"map.addOverlay(marker);"
"marker.openInfoWindowHtml(\"<b>Coucou</b>, ici c'est Reykjavik
\");"
, latitude
, longitude];

[mapWebView evalJS:script];

So it works but informative window is already open. I tried this
(replaced openInfoWindowHtml by bindInfoWindowHtml

NSString *script =
[NSString stringWithFormat:
@"var point = new GLatLng(%f, %f);"
"var marker = new GMarker(point);"
"map.addOverlay(marker);"
"marker.bindInfoWindowHtml(\"<b>Coucou</b>, ici c'est Reykjavik
\");"
, latitude
, longitude];

[mapWebView evalJS:script];

But it does not work.

Finally I tryed this:
NSString *script =
[NSString stringWithFormat:
@"var point = new GLatLng(%f, %f);"
"var marker = new GMarker(point);"
"map.addOverlay(marker);"
"GEvent.addListener(marker, \"click\", function() {"
"marker.openInfoWindowHtml(\"<b>Coucou</b>, ici c'est Reykjavik
\");"
"});"
, latitude
, longitude];

[mapWebView evalJS:script];

It does not work neither. Maybe click on marker is ignored and I do
not know why.

Any help ?

Best regards,
Quentin

On Jan 9, 9:29 am, MrXino <ni...@extremedesigns.nl> wrote:
> Does anybody has an idea about changing the code so pins can be opened
> (so additional information can be viewed)? For example a map like
> this:http://code.google.com/intl/nl/apis/maps/documentation/examples/icon-...
Reply all
Reply to author
Forward
0 new messages