Clickable and draggable Marker support is now available

5 views
Skip to first unread message

mshalaby

unread,
Apr 8, 2009, 4:10:19 PM4/8/09
to iphone-map-view
You can now add native (non-javascript) markers to your map view.
Markers are clickable and optionally draggable

Adding this feature needed changes to the MapView class and adding a
MapMarker class.

Markers are added as sub-views to the map view. Handling click, drag
and release events are implemented using delegate methods.

To see this in action check out the last revision and build and run
the application in Xcode.
The application is a demo that shows both draggable and non-draggable
markers in action.

I added a MapViewController class just to hold code constructing the
mapview, buttons and specific markers for this demo.

In this simple demo markers are added to the center of the map so make
sure you change the center of the map before adding new markers.
clicking on a marker will show its latitude and longitude on the black
label at the bottom.
You can try dragging the markers around you'll get their new locations
updated when released.

Nick

unread,
Apr 25, 2009, 4:11:02 AM4/25/09
to iphone-map-view
This new update is excellent.

I have it working, and would like to submit a small patch to allow the
double click events on the markers to be handled by the delegate too.

There is one problem I am having however: when my MapView loads it
doesn't show the marker I've added during the viewDidLoad() method in
my controller. Only after I move the map slightly does the marker
appear.

I can't seem to figure out why this is happening - any hints would be
greatly appreciated.

I will create a patch for the double click event callbacks.

Cheers,
Nick
Reply all
Reply to author
Forward
0 new messages