chogath chogath - 5 months ago 14
iOS Question

Draw Straight Line Google Maps iOS

hey everyone I'm working on an iOS app and I integrated Google Maps API and I'm using Objective C

I implemented a function that put marks on the maps for every touch to the screen + I get the longitude and latitude of that mark

I want to draw straight lines between those marks, every time I add a new mark it should be linked with the one before

Any ideas please !

Answer
GMSMutablePath *path = [GMSMutablePath path];
[path addCoordinate:CLLocationCoordinate2DMake(37.36, -122.0)];
[path addCoordinate:CLLocationCoordinate2DMake(37.45, -122.0)];

GMSPolyline *line = [GMSPolyline polylineWithPath:path];
line.map = mapView_;
Comments