草庐IT

pointAnnotation1

全部标签

ios - 如何在 Swift 中将按钮添加到 MKPointAnnotation

我希望能够在我的map注释上放置一个按钮和标签。带有标题、副标题和坐标的注释效果很好,但我无法显示按钮。funcdrawEvents(_loc:CLLocation,title1:String){mapView.delegate=self//letcenter=CLLocationCoordinate2D(latitude:loc.coordinate.latitude,longitude:loc.coordinate.longitude)letlat:CLLocationDegrees=center.latitudeletlong:CLLocationDegrees=center.l

ios - MKMapView 上的 PointAnnotation 标注出现然后立即消失

我正在UITapGestureRecognizer委托(delegate)中创建一个带有标注的简单点注释。我第一次点击map时,图钉与标注一起出现,但之后标注立即消失。我第二次点击同一个图钉时,标注出现并停留在那里,不知道为什么它在第一次时消失了。@IBActionfunchandleMapTouch(recognizer:UITapGestureRecognizer){letview=recognizer.viewlettouchPoint=recognizer.locationInView(view)vartouchCord=CLLocationCoordinate2D()touc