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)?
?
Related
I want an animated image as annotation in my Mapview in iOS. I tried one gif image with the help of a third party library to animate, but it won't animate but it animate in normal imageview. I also tried animatedImageNamed with the help of 3 images, but it won't work. How can add animation in my annotation. I want a dot with animated layers (layers are appear and disappear). Just like attached image
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.
I have a UIImageView set on top of a scrollView. The image is a map, and I need to annotate buttons across the map to corresponding locations (very specific to the region). The buttons are visible, and they pan and scale accordingly when scrolled/zoomed, this works great. The issue is when the buttons are rendered on different screen sizes, the buttons are placed in different spots since auto-layout puts them the same distance from the edge of the screen, but the image has a different bounds property and is bigger/smaller depending on the device.
I've considered creating an MKMapView with a custom overlay of this image, but I was hoping to keep it super light-weight and avoid MapKit all together.
Any suggestions? Clarifications are fully encouraged :)
You should add buttons as subviews on imageview so that buttons transform in the same way as imageview does.
I have got a MapView with some custom MKAnnotation, MKAnnotationView which I use to create nice custom callout.
Anyway, for my main Annotation Pin, I use some nice image of pins with a pre-rendered shadow on their left.
However, I would like the annotation not to get selected when the user touch its shadow. Because when their are a lot of them, the shadow of one can overlap another, and the wrong one gets selected because the shadow gets touched.
I have tried to use a separate image for the shadow and put it in a UIImageView inside the MKAnnotationView but it does not change anything, even if I put enableUserInteraction = NO.
any idea?
Make your MKAnnotationView the size of the image excluding the shadow. Change it's frame so that it encompasses the part you want it to receive touch. The shadow should exceed this frame, but shouldn't be cut off.
i am working on a project in which i have added a UIimageview to show an image selected by user. Now requirement is that if user want to crop an images it can touch the image according to crop requirement. when user cropping the image a line should draw at place where user has touched. i know that UITouch class will use for it. But i am unable to do it.
A couple of possible solutions.
1) Create a custom UIView that contains a UIImageView as it's subview. Make the UIImageView be the same size as the custom UIView. Then add code to detect the touches on the custom UIView and draw the lines on top of the UIImageView subview.
2) Create a custom clone of UIImageView that draws the image first as the 'background' and then detects the touches and draws the lines on top of the image.
Also make sure you have userInteractionEabled set to YES on the view receiving the touches.