Don't resize annotation on MKMapView zoom-in/out - ios

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.

Related

Drag MapBox map on different UIView (iOS)

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.

Add a UIView at specific coordinates to a MKMapView

I want to add a UIView to fixed coordinates on the mapview like a annotation. To be more specific the UIView should stay fixed at these coordinates on the mapview when the mapview is in interaction (moving, zooming, etc.) exactly the same like a annotation does it.
I tried to solve it with MKMapPoint but without success.
Hope someone has a tipp!
As I understand you want to use custom annotatin view. There is an answer for that question. I dont think you can use a UIView as you described.
How to create Custom MKAnnotationView and custom annotation title and subtitle

How to use animated custom Pin (gif image) inside Mapview?

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.

Custom MKAnnotationView, how to prevent selection when shadow touched

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.

Strange positioning after using MKAnnotationView centerOffset

in iOS 5.0, I first place annotations on the map and also set the centre offset to CGPointMake(0,-annotationView.frame.size.height/2); right after setting the custom image for the annotation in the mapView:viewForAnnotation: method... after this the pins still appear at the original position which would be the case when the centre offset was not applied.
However, when I pinch or zoom the map, the annotation jumps to the correct position as would be the case with the centerOffset being set and then behaves correctly..
What could be the reason and solution for this?
Any help would be much appreciated.
Baffled!!
I was finally able to solve it by subclassing the MKAnnotationView and in the initWithAnnotation:reuseIdentifier: constructor method, synchronously get the annotationView image and then set the centerOffset to CGPointMake(0.0, -img.size.height/2);
If there are too many annotations, this will slow down the display of annotations, so would need to handle that differently.

Resources