I want to add a pin on UIImageView at particular coordinates in ios. I am not using mapkit. I have to do it on imageview. example picture is attached.
Please help me in this issue.
I have a simple solution, you can try it.
Every pin is a UIButton with "pin" image. You can add a pin at particular location in UIImageView by using frame or autolayout.
To show the windowview on top of pin, you can add action to each pin and detect pin by add tag or by another property.
Related
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.
Our UIView contains a MapBox map. At certain moments during our apps lifespan we display a UIView on top of the Map.
This view had a transparant background and a couple of controls inside it. What we want is to be able to drag the map on the spots where the view is transparent. (It should basically pass through the gestures to the view below it..which is the map).
To get a basic picture of what we try to accomplish: think of a map and above it is a view which shows a big + sign. What we want is when we drag the actual sign...nothing happens. But when you drag in the empty corners, it should drag the map.
Any ideas how to accomplish that?
Check out -[UIView userInteractionEnabled] and set it to NO for the transparent view. Be sure to set it to YES for the control subviews. That should do the trick.
I ran into a problem while building a map app. I'm trying to do the following:
add an animated PNG sequence as overlay to the map so that it appears to be "on the map" while the user changing the zoom, rotation and pitch of the map.
on top of that PNG sequence I would like to show a custom pin image, using MKAnnotationView.
So far, what I've been able to do is:
Load PNG sequence into an UIImageView and animate them.
add the UIImageView to the MKMapView, using addSubView:.
Detect changes to the MKMapView and update the position of UIImageView accordingly
However, if I start adding MKAnnotations to the MapView, they get added below my UIImageView (see image on the left).
Is there a way to add them on top of the UIImageView (see image on the right)?
?
I want to add multiple pins on map which should remain animated continuously. Below are sample images which I want to use as Pin,
Is there any possible way to get this type of animated pin within MapKit? If possible then please suggest me appropriate way for it.
As per my knowledge it is quite tough to implement. You can easily implement animation on any UIImageView but when you add any image on custom image then you can change custom pin image via using KVO or via NSTimer.
Please follow Animation with MapView Custom Pin link to better understanding with custom pin annotation.
You can change pin image too after a certain period of time like as Zooming change pin image
and Custom pin animation - MKMapView.
I hope it will help you to better understanding. Thanks
You could create a custom MKAnnotationView and give it a UIImageView as a subview.
Then, split the GIF into separate frames, to use in the UIImageView, as documented in this SO question.
In the showcallout part that is placeholder for address, title subtitle in annotations, is there a way to add subview? What I want is to put small rectangle on the top of this box(callout).
check this app - https://github.com/akshay1188/CustomAnnotation