我是 iOS 开发和 Mapbox 的新手,如果问题听起来很愚蠢,我很抱歉,但我在任何地方都找不到答案。\n我有一张地图和上面的注释。我想在用户触摸并按住注释(长按手势)时显示一些其他信息。我有长按手势来工作,但找到了找到被触摸的注释的方法,或者至少是它的索引。到目前为止我是这样的:
\n\nclass eventsMapController: UIViewController, MGLMapViewDelegate {\noverride func viewDidLoad() {\n super.viewDidLoad()\n mapView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]\n\n // Set the map\'s bounds to Oslo 59.920269,10.71167\n //let bounds = MGLCoordinateBounds(sw: CLLocationCoordinate2D(latitude: 59.925861, longitude: 10.712185),\n // ne: CLLocationCoordinate2D(latitude: 59.889798, longitude: 10.794754)) \n view.addSubview(mapView)\n\n // Set the map view\xe2\x80\x98s delegate property\n mapView.delegate = self\n\n let myGesture = UILongPressGestureRecognizer(target: self, action: #selector(eventsMapController.testLongGesture))\n myGesture.minimumPressDuration = 0.8\n mapView.addGestureRecognizer(myGesture) \n}\nfunc testLongGesture(long: UILongPressGestureRecognizer){\n if long.state == .Began{ \n print("begin", long)\n }\n}\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我正在添加这样的注释
\n\nlet pointAnotation …Run Code Online (Sandbox Code Playgroud)