swift - Prevent MapView MKPolygon tapped on Annotations? -
i have mkmapview mkpolygons , few custom annotations. when ill try tap on annotation inside mkpolygon, trigger polygon gets fired.
can prevent this? ill check on polygon tap:
func handlemaptap(tap: uitapgesturerecognizer!) { var tappoint = tap.locationinview(self.mapview) var tapcoord: cllocationcoordinate2d = self.mapview.convertpoint(tappoint, tocoordinatefromview: self.mapview) var mappoint: mkmappoint = mkmappointforcoordinate(tapcoord) var mappointascgp: cgpoint = cgpointmake(cgfloat(mappoint.x),cgfloat(mappoint.y)) overlay in self.mapview.overlays { if(overlay.iskindofclass(mkpolygon)) {
this how looks like:
any ideas? can make "larger" area annotion, not fire both events, annotation , mkpolygon?
edit: anna,
ill tried that, brings me "found nil while unwrapping optional value" error when ill try with:
var v:uiview = mapview.hittest(mappointascgp, withevent: nil)! // error if(v.iskindofclass(custompointannotation) == true) {
Comments
Post a Comment