Я создал собственную аннотацию с помощью «MKMarkerAnnotationView», она отлично работает с текущими стабильными версиями iOS (от 15 до 18), но в iOS 26 аннотация по умолчанию отображается позади моей аннотации. я проверил инспектор пользовательского интерфейса Xcode, и в «MKMarkerAnnotationView» появилось новое подпредставление под названием «MKMarkerBalloonView», и именно оно отображается.
Чтобы внести ясность, проблема заключается в запуске приложения на iOS 26, даже если я собираю с iOS 18.x, у меня все еще есть проблема на устройствах под управлением iOS 26.
Я также попробовал отказаться от жидкого стекла, добавив UIDesignRequiresCompatibility в info.plist, но это ничего не изменило.
вот "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))
}
}
Код: Выделить всё
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
}
}
Проблема в iOS 26:

Подробнее здесь: https://stackoverflow.com/questions/797 ... tation-bug
Мобильная версия