mapbox-maps-ios
mapbox-maps-ios copied to clipboard
Custom annotation view floating on HStack or Stack issue
Environment
- Xcode version: 13.4.1
- iOS version: 15.5
- Devices affected: iPad
- Maps SDK Version: 10.5.0
Observed behavior and steps to reproduce
Custom annotation view is floating over the HStack or VStack when user panning around on the map.
Expected behavior
Custom annotation view should not float over the HStack or VStack when user panning around on the map.
@Asheshp23, can you please provide a video of the behavior you're experiencing?
https://user-images.githubusercontent.com/22404192/189655149-3458697d-1905-4c00-94a8-89cf0fa9af1c.MOV
This is how i am adding the custom annotationView
let options = ViewAnnotationOptions(
geometry: Point(coordinate),
allowOverlap: true,
anchor: .center
)
mapView.viewAnnotations.removeAll()
let customAnnotationView = UIHostingController(rootView: AnnotationView(text: name))
customAnnotationView.view.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
customAnnotationView.view.backgroundColor = .clear
try? mapView.viewAnnotations.add(customAnnotationView.view, options: options)
// move annotationView up so that it will not cover the point annotation
try? mapView.viewAnnotations.update(customAnnotationView.view, options: ViewAnnotationOptions(offsetY: 30.0))
@Asheshp23, thank you for reporting this. Are you able to use UIViews instead for your ViewAnnotations?
Closing this ticket, but please feel free to reopen if you have any additional questions related to this issue.