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.
Related
I'm trying to divide one image to a more than one clickable part. for example, if the image is a body image, and I tapped the head, it should take me to a different the HeadViewController, but if I tapped on the left hand, it should take me to a different view controller
Any idea how to do that?
Easy method:
Add UIButtons on top of the image with clear background color. You can do this with AutoLayout and always get correct proportions to the areas when scaling up and down.
Hard method:
Add UITapGestureRecognizer to the UIImageView and calculate CGPoint depending on where it the touchPoint is received. This is complicated and must be calculated correctly.
For you, I suggest the first method suggested.
Attach a tap gesture recognizer to your image view. Set user interaction enabled to true.
In the handler for the tap gesture, fetch the coordinates of the user's tap and write custom code that figures out which "hot box" the user tapped in.
Alternately you could create a custom subclass of UIGestureRecognizer that has multiple tap regions.
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.
Here is my code: https://ghostbin.com/paste/mvhdx
When my view is zoomed-in/out, the annotations resize. Is there a way to disable this behavior and keep the annotations at the size that they were created at?
Another bonus question, how do you prohibit a MKAnnotationView from rotating as well?
If you want to create shapes that are fixed to geography, you may want to look at overlays instead of annotations.
iOS7AnimatedMapOverlay shows how to add overlays to annotations.
I would like to implement the similar feature as in the facebook iPad app in which the text can be added to an image as in the below image.
I can add a view like this with the text in the imageview, but don't know how to keep the size of the added view like in the below image when its zoomed in or out (like pins in mapview)?
Can some one suggest me implement like in the above facebook tagging feature in my app? Thanks in advance.
You should put your image in a scrollView to be able to zoom it.
Your tags are views added on the [scrollView superView], so you can zoom the image and your tags keep the same size.
Then with a bit of logic and the convertPoint methods of UIView you should retrieve the coordinate of the anchor in the resized image.
- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view
It's not a fully baked answer but you should have steps. Maybe you can also find some open source implementation to use or inspirational
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.