GMSMarker没有addGestureRecognizor?

时间:2018-04-07 04:54:54

标签: swift xcode google-maps uigesturerecognizer

如何检测是否已点击标记?

这是我的代码:

 let Meridian = GMSMarker()
        Meridian.position = CLLocationCoordinate2D(latitude: 5.654874, longitude: 100.5320142)
        Meridian.title = "Recycling Factory"
        Meridian.snippet = "Meridian World Sdn Bhd"


        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.showMeridianInfo))
        Meridian.addGestureRecognizer(tapGesture)//here is where I get the error


  @objc func showMeridianInfo (sender: UITapGestureRecognizer) {
        print("meradin")


    }

1 个答案:

答案 0 :(得分:0)

你必须遵守SELECT a.* FROM questions as q, answers as a WHERE a.question_id=q.id 并实施:

GMSMapViewDelegate

在此功能中,您可以访问所选的标记详细信息,如标题等。

func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {}