有没有办法避免iOS中的闪烁注释?

时间:2018-04-11 19:15:07

标签: ios swift mapkit mapkitannotation

我正在抛光我的应用并希望避免注释的闪烁。有什么方法可以解决这个问题吗?

目前我在创建新注释后立即删除旧注释

DispatchQueue.main.async {

        let annotation = MKPointAnnotation()
        annotation.coordinate = locations.last!.coordinate

        annotation.title = "Speed"
        let speed = locations.last!.speed * 3.6 // converting to km/h
        annotation.subtitle = String(format: "%.2f km/h", speed)

        self.mapView.addAnnotation(annotation)

        if let oldAnnotation = self.drawer.oldAnnotation {

            self.mapView.removeAnnotation(oldAnnotation)

        }
        self.mapView.selectAnnotation(annotation, animated: false)

        self.drawer.oldAnnotation = annotation
}

flickering

0 个答案:

没有答案