Я работаю над MapKit в Swift и у меня возникли некоторые проблемы с ним. Я показываю аннотации с изображением на MapKit, и оно показывает одно изображение за 100 мс, а затем показывает реальное изображение.
extension MapVC: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
var annView = mapView.dequeueReusableAnnotationView(withIdentifier: "pin")
if annView == nil {
annView = MKAnnotationView(annotation: annotation, reuseIdentifier: "pin")
annView?.canShowCallout = true
}
let manager = SDWebImageManager.shared
let imagePath = (annotation as! PointAnnotation).user?.photo
manager.loadImage(with: URL(string: imagePath!), options: .continueInBackground, progress: nil) { (image, data, error, cacheType, finished, url) in
if image != nil {
annView?.image = image?.resizeImageWith(newSize: CGSize(width: 16, height: 16))?.circleMasked
}
}
return annView
}
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
let annotation = view.annotation
let user = (annotation as! PointAnnotation).user
let me = mainStore.state.profile
if user === me {
return
}
let vc = ChatVC.storyBoardInstance
vc.user = user
self.navigationController?.pushViewController(vc, animated: true)
}
}
, пожалуйста, помогите мне в этой проблеме