How to fix the annotation image on map view? - ios

I am working on app which will show the current user location on map.I am using the custom annotation on map view for example a car image.I am rotating this image by finding the angle between two locations.But whenever user rotates the map view my annotation also rotates which is for obvious reason and my image moves in wrong direction.In android we can set flat property to true so whenever user will rotate the map the annotation image will also rotate along with it.
Please suggest something useful.Thank you.

Related

Moving Map Under the Marker in Mapbox iOS SDK

I am new in MapBox iOS SDK and I need to add a marker in the center of MGLMapView so that user would be able to move map view under the marker and the marker would be fix on the screen. I also need to get the coordinate of the point in the map that is under the marker. I could not find any method in Mapbox SDK and I have no idea how to do that.
I believe this is quite easy. Add an image of a marker on top of the map to give the visual effect so the user can still scroll around without moving the marker. Then you can get the center coordinates usually quite easily using mapView.centerCoordinate when the user stops scrolling.
Here is the API documentation link for reference
I had done something like this in one of my apps
1) Add map to UIViewController
2) Add a Transparent view on top of the map in UIViewController. (May need to set userInteractionEnabled to false. Not sure though!)
3) Add marker image to the Transparent view so that its bottom tip is at the center of the view it is added to.
4) Get center coordinates by using mapView.centerCoordinate
For other people who have this issue too:
let markerImageView = UIImageView(image: UIImage(named: "Orange"))
markerImageView.center = mapView.center
mapView.addSubview(markerImageView)

implement fog(blur) in map

i will try to last some days but not getting any idea to how can i solve this.here are some screenshot
when first time screen display than only userlocation is display in map and other map is blur but when user can move to another position than clear each position blur effect like my second screenshot
please give me some logic how can i solve this.

How to keep an MKAnnotation View Image fixed on the center of the map as the user pans and moves the map around (Swift)?

using target 8.0 MapKit, I would like to define an MKAnnotation (such as a pin, or a custom one) that remains fixed on the center of the map view as the user moves the map around. Once the user stops moving the map, I would like to be able to read the new coordinates of the annotation. How can I do this? This in swift, thank you soo much
You can follow this link to accomplish this task.They are doing something very similar to your requirement. Its quite descriptive. Link

snapshot/screenshot with MKMapview

I am trying to make a snapshot from a view with a MKMapview to provide a springboard like folder animation when the user selects an annotation.
The official way to make a snapshot of the current window is presented here. This works fine (though quite slow) unless the mapview is not zoomed in too much and has a "regionThatFits" set. The map & the marker make an unmatched "jump" to the left and the gridlines of the mapview are visible:
Before screenshot:
After screenshot:
I suppose it has something to do with the tiled parts of the map but I don't know how to prevent that behaviour.
Any thoughts?

Adding Custom Image on Mkannotationview, or on callout bubble?

i'm trying to reproduce the kind of map behavior of the app "Stuck On Earth". Here's a screenshot :
Here's the behavior :
On the map, as you can see there is pin
When you click on a pin, it display the picture attach to it. Really important : the picture stai with the pin, and it stays BEHIND it
If you click on the picture, a new controller is called
if you click on the pin, the picture disappear
I'm trying to do something similar. For now, as i can read, i've got two solutions :
Using callout : callout is HELL. I can try to use a false annotation, but MapKit deals with the depth of elements, and the picture is always in front of the pin
Using Custom Annotation : i was going for the plan of making custom annotation view, when the pin is tapped, i launch a method of the CustomAnnotationView, adding (or removing) the thumbnail.
I think the method number 2 could work, but i've got no idea how to deal with the touch on the thumbnail.
Any suggestions or help on this ?
Thanks you !
Updated 2016-09-02:
My colleague devised an workaround by making popup views as subview of the view container which contains the map view. The position can be calculated according to the CGPoint transform in different reference systems.
Original Answer:
I also got this kind of problem, after following the tutorial 'Building Custom Map Annotation Callouts – Part 1', the interaction becomes difficult.
Have you tried the tap gesture recognizer? I added it to a subview, it works, although the code smell bad.

Resources