ios - Make GMSCircle respond to tap? -


i using google maps api ios , want make when tap on gmscircle pops little thing coded elsewhere. have set circle "tappable" cannot find need set or make listen tap. use?

    cllocationcoordinate2d circlecenter = cllocationcoordinate2dmake(10,10); gmscircle *circ = [gmscircle circlewithposition:circlecenter                                          radius:10]; circ.tappable = true; [circ setfillcolor:[uicolor colorwithred:1 green:0 blue:0 alpha:.5]];  circ.map = mapview_; 

you need use delegate method didtapoverlay :

- (void) mapview: (gmsmapview *) mapview  didtapoverlay: (gmsoverlay *) overlay  

here parameter overlay indicates overlay tapped. need check if equals circ.

edit : adding details on how check circle within didtapoverlay

when gmscircle added map, corresponding gmspolygon created. if circle set tappable, on tapping it, overlay passed didtapoverlay method related polygon , not circle . direct comparison between overlay , circle not possible. hence raspu pointed out, can set value in title using circ.title = , inside didtapoverlay, can check if overlay.title same circ.title. works because title property of circle within corresponding polygon , hence present in overlay parameter.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -