Search code examples
swiftmkmapviewmkannotationmkannotationviewmkpointannotation

My mapview hides a lot of annotation points, how do i force ALL points to show?


I have 200+ points on my map and they a lot of them are hidden upon runtime until zoom in is increased. Is there a boolean function or other to resolve this?


Solution

  • You need to create your annotation view class outside of your view controller and change it’s displayPriority = .required

    class annotationView: MKMarkerAnnotationView {
    
      override var annotation: MKAnnotation? {
        willSet {
            
          guard let "arrayOfAnnotations" = "newValue" as? "annotationClass" else {
            return
          }
            self.displayPriority = .required
          }
        }
    }