I'm trying to build a location selector in swift. The idea is :
When the map appears, an annotation pin appears at the user location. Then the user can change the location of the pin by moving the map around. (the pin stays at the centre of the screen. Like the uber app).
I have no issue spawning an annotation at the user location when the map loads. But I can't find a way to keep the pin at the centre of the screen when the user moves the map around.
I believe I must use regiondidChangeAnimated function, but I can`t find a way to update smoothly the position of the annotation.
Thank you for your help !
When you want some view to not move when you pan the map, just put it on the map view's
superview (e.g. add a
UIImageView to that
superview), add the necessary constraints so that it's centered where you want it, and make sure that user interaction is disabled with that image view. Then you can pan the map and the image view will gracefully float there, above the map, not moving at all.