IPhone - MapKit - Locating and Moving Annotations

I want to make an application that partially mimics some of the actions that a standard map application has. It turned out to be difficult. First of all, I don’t understand how you make annotations mobile. How exactly do you do it?

Second: how to look for places?

+6
iphone mapkit mkannotation
source share
2 answers

Moving annotations

I assume that you follow the behavior of Maps.app, where you click and hold the pin to move it freely. As far as I know, there are no built-in annotation methods. Since annotations are subclasses of UIView , although you can draw them where and how you want. For example, you can, for example, detect tap-n-hold in the annotation, and when β€œunlocked” change the centerOffset value of your annotation to move it with a touch. When the user allows you to go to the view, you can mark the position on the screen and use the method MKMapView convertPoint:toCoordinateFromView: to get the coordinates that the pin released.

Location search

What you are looking for is called Forward Geocoding. Unfortunately, MapKit comes with reverse geocoding (the process of converting GPS coordinates to a country / city / street / etc.). However, there are several alternatives. Here are some ways:

Please note that many geocoding APIs are licensed under a Creative Commons license or similar.

+15
source share

You should be able to get drag and drop annotations coming with this blog post. I used it to do the same, and it was pretty easy to go.

Drag and drop MapKit annotation with updated callout information

+3
source share

All Articles