google maps - How to implement GMSMarker drag drop on GMSMapView? -
i set marker on google map when drag it's of map drag.
i want drag marker when click , drag on it's
and drag map when click , drag outside marker.
this code
self.camera = [gmscameraposition camerawithlatitude:-33.86 longitude:151.20 zoom:6 bearing:0 viewingangle:0]; self.map = [gmsmapview mapwithframe:self.mapview.bounds camera:self.camera]; self.map.mylocationenabled = yes; self.map.delegate = self; gmsmarker *marker = [[gmsmarker alloc] init]; marker.position = self.camera.target; marker.draggable = yes; marker.title = @"sydney"; marker.snippet = @"australia"; marker.map = self.map; marker.icon = [gmsmarker markerimagewithcolor:[uicolor bluecolor]]; marker.appearanimation = kgmsmarkeranimationpop; [self.mapview addsubview:self.map];
and event on drag drop
- (void) mapview:(gmsmapview *)mapview didbegindraggingmarker:(gmsmarker *)marker { } - (void) mapview:(gmsmapview *)mapview didenddraggingmarker:(gmsmarker *)marker { } - (void) mapview:(gmsmapview *)mapview diddragmarker:(gmsmarker *)marker { }
when run app , debug above event not work. event click on marker work well.
how implement drag drop ?
you have press-and-hold on marker before begin dragging. thought wasn't working either until pointed out... needs in google's documentation.
Comments
Post a Comment