ios - UITapGestureRecogniser in GMSMapView -
i creating app using swift. in 1 of viewcontroller, have gmsmapview create programatically. want user have capability triggering action when clicking on map.
what have done :
import uikit class mapviewcontroller: uiviewcontroller, gmsmapviewdelegate { let mapview = gmsmapview() override func viewdidload() { super.viewdidload() mapview.delegate = self mapview.settings.scrollgestures = false mapview.frame = cgrectmake(0, 65, 375, 555) view.addsubview(mapview) var tap = uitapgesturerecognizer(target: self, action: "tap:") mapview.addgesturerecognizer(tap) } func tap(recogniser:uitapgesturerecognizer)->void{ println("it works") } }
i have tried override touchesbegan, didnt work. have tried insert mapview.userinteractionenabled = true, didnt work...
any idea?
i managed
func mapview(mapview: gmsmapview!, didtapatcoordinate coordinate: cllocationcoordinate2d) { println("it works") }
but if explain me why other solution didn't work, great!
Comments
Post a Comment