【发布时间】:2016-02-19 00:54:41
【问题描述】:
有没有办法在更改自定义 MKAnnotation 数据后更新自定义 MKAnnotationView?这是观察者发挥作用的地方吗(以前没有使用过这些)。
例如,目前我正在手动执行以下操作:
更改数据后在我的自定义 MKAnnotation 中:
let annView: GCCustomAnnotationView = self.mapView.viewForAnnotation(annotation) as! GCCustomAnnotationView
annView.updateText()
在我的自定义 MKAnnotationView 中:
func updateText() {
let gcAnnotation : GCAnnotation = self.annotation as! GCAnnotation
calloutView.line1.text = gcAnnotation.locality
calloutView.line2.text = gcAnnotation.sublocality
calloutView.line3.text = gcAnnotation.name
}
【问题讨论】:
标签: ios swift mapkit mkannotation mkannotationview