JAK
JAK

Reputation: 6481

how to drag circular view in google map iOS Sdk

I am using Google Map iOS sdk in my iPhone project.I attached one image with this question and i can darw circle but cannot drag circle from one position to another position.I am using following code for drawing a circle.I need view as image shows and also need drag the circular area.Please help me

CLLocationCoordinate2D circleCenter = CLLocationCoordinate2DMake(-33.85, 151.20);
GMSCircle *circ = [GMSCircle circleWithPosition:circleCenter
                                         radius:1000];
circ.fillColor = [UIColor grayColor];
circ.strokeColor = [UIColor redColor];
circ.strokeWidth = 5;
circ.map = mapView;

enter image description here

Upvotes: 1

Views: 1293

Answers (2)

Nilesh
Nilesh

Reputation: 438

If you have fixed radius. Create image in photoshop. Assign it to marker. And set property as draggle to marker. So you will now be able to drag the marker as you want.

Upvotes: 0

Ryuichi Yamamoto
Ryuichi Yamamoto

Reputation: 21

I investigated this for a few hours but no direct solution wasn't found so far. However, I found a way to achieve this. The solution is to clear circle and re-draw a new circle while dragging.

If a circle is drawn around a GMSMaker, dragging circle can be achieved to implement the delegate method that is called while dragging a marker:

 -(void)mapView:(GMSMapView *)mapView didDragMarker:(GMSMarker *)marker {
     [mapView clear];

     // Re-draw marker
     marker.map = mapView;

     // Create your circle with the new marker
     GMSCircle *circ = [GMSCircle circleWithPosition:marker.position radius:1000];
     circ.fillColor = [UIColor grayColor];
     circ.strokeColor = [UIColor redColor];
     circ.strokeWidth = 5;
     circ.map = mapView;
 }

EDIT:

Note that [mapView clear] clears all overlays (include makers). Sometimes it may not be a good solution.

Upvotes: 2

Related Questions