0

In iOS 26 i have an issue with mapKit. i created a custom annotation using "MKMarkerAnnotationView", it works fine with current stable iOS versions (15 to 18) but with iOS 26 the default annotation is displayed behind my annotation. i checked the Xcode UI inspector and there's a new subview in the "MKMarkerAnnotationView" called "MKMarkerBalloonView" and it's the one displayed.

To be clear, the issue is when running the app on iOS 26, even if i build with iOS 18.x i still have the problem on devices running iOS 26.

i also tried opting out of the liquid Glass by adding UIDesignRequiresCompatibility in the info.plist but it change nothing.

here's the "MKMarkerAnnotationView"

    
    static let reuseId = "AnnotationMarkerView"
    
    private lazy var annotationView: UIView = {
        let hostController = UIHostingController(rootView: AnnotationView())
        let view: UIView = hostController.view
        view.translatesAutoresizingMaskIntoConstraints = false
        view.backgroundColor = .clear
        view.accessibilityElementsHidden = true
        return view
    }()
    
    init(annotation: MKAnnotation, reuseIdentifier: String?) {
        super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
        
        self.setupUI()
        
        self.displayPriority = .required
        self.collisionMode = .circle
        
        self.titleVisibility = .hidden
        self.subtitleVisibility = .hidden
        self.markerTintColor = .clear
        self.glyphTintColor = .clear
        self.glyphImage = nil
        self.selectedGlyphImage = nil
        self.glyphText = nil
    }
    
    required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
    
    private func setupUI() {
        self.backgroundColor = .clear
        self.addSubview(self.annotationView)
        self.annotationView.centerXAnchor.constraint(equalTo: self.centerXAnchor, constant: 0).isActive = true
        self.annotationView.centerYAnchor.constraint(equalTo: self.centerYAnchor, constant: -24).isActive = true

        self.bounds = .init(origin: .zero, size: .init(width: 0, height: 0))
    }
}

and the MapViewDelegate:

    
    func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
        
        guard let annotation = annotation as? Annotation else {
          return nil
        }
        
        let annotatonView = AnnotationMarkerView(annotation: annotation, reuseIdentifier: AnnotationMarkerView.reuseId)
        
        return annotatonView

      }
}

Link to a demo project.

issue on iOS 26:

iOS 26 MapKit Annotation issue

2
  • Same issue here. There is no "MKMarkerBalloonView" with MKAnnotationView - are you able to use MKAnnotationView instead? Commented Aug 20 at 1:03
  • 1
    yep it works fine using MKAnnotationView 👍 you can add an answer so i can validate it ;) Commented Aug 22 at 7:35

1 Answer 1

3

Subclassing MKAnnotationView (instead of MKMarkerAnnotationView) resolves this issue.

Using MKAnnotationView doesn't support a few MKMarkerAnnotationView specific features, but they aren't used in the snippet anyway (titleVisibility, markerTintColor, etc.)

Sign up to request clarification or add additional context in comments.

2 Comments

we're using titleVisibility to show title of poi. Any other approach to fix it?
Were you able to resolve this? Having a hard time trying to find documentation on how to add an image to the balloon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.