Я делал некоторые аксессуары для выноски в функции аннотации, и вдруг мои аннотации были скрыты? Они только скрыты, потому что, если я нажму место, где я знаю, что есть аннотация, появится аннотация. Хуже всего то, что я не могу просто пожалеть (Cmd + Z), потому что мой компьютер пошел вниз во время работы проекта. Я не могу понять, что я изменил, что скроет булавки.Мои аннотации контакты скрыты
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let identifier = "MyCustomAnnotation"
var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier)
if annotationView == nil {
annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: identifier)
annotationView?.canShowCallout = true
} else {
annotationView!.annotation = annotation
}
let image = UIImage(named: "advance.png")
let button = UIButton(type: .DetailDisclosure)
button.frame = CGRectMake(0, 0, 30, 30)
button.setImage(image, forState: .Normal)
annotationView?.rightCalloutAccessoryView = button
let detailImage = UIImageView(frame: CGRectMake(0, 0, 50, 50))
detailImage.image = UIImage(data: fishimages!)
annotationView?.leftCalloutAccessoryView = detailImage
return annotationView
}
Вы действительно хотите вызвать 'MKAnnotationView()' для выделения незарегистрированных * выводов *? Современная практика заключается в использовании 'let annotationView = MKPinAnnotationView (аннотация: annotation, reuseIdentifier: identifier)', который всегда будет возвращать не-nil pin ... – Grimxn