How to add a text on mapView in swift 3? - ios

I'm trying to display a text at a certain location on a mapView.
I can display annotations, overlays like polylines, etc.
But how can I do to display a simple text directly on a map ?
I can't find any documentation on that anywhere (for the moment ;)
Thanks for your help !

Related

Multiple callouts for MapBox

I need to display mutliple callouts for a set of annotations in MapView (actually just need show more information on top of annotations, thought that callouts is the way to go).
Is is possible? How can it be done?
Thanks

How to show Map with multiple annotation in UITableViewCell?

I have UITableViewController and inside my cell i need to display map with multiple annotations.
I need to show map on my tableview cell and plot multiple annotation in that map also.
Something like this Screenshot
I searched in google and couldnt get that much help.
If you don't need interaction with the map (scroll, zoom etc) you can use MKMapSnapshotter. It generates a snapshot image of the map and requires much less memory than actually using a map view. A useful link is this: http://nshipster.com/mktileoverlay-mkmapsnapshotter-mkdirections/
Another option when interaction isn't needed is the MapboxStatic library, which gives PNG or JPEG images of maps, which is ideal for table view usage.

Annotation pins and detail view from sqlite

I've been looking around the Internet to find a tutorial or something to explain this.
I need to show some pins on a map. I need to get them from a sqlite database (table with POI's name, lat, lon, and some text). They have to show annotations callouts with title and subtitle and open their detail views.
All that with Objective-C.
How can I do that? Can anybody help and write the code?
I'd recommend using FMDB to get files from a local sqlite db. This stack answer is pretty helpful in getting started on that. It might take an hour to get up to speed on it, but you'll save that hour many times over once you're comfortable with it.
Now that you're able to retrieve data from your db, you need to create MKAnnotations for each pin you want to drop on the map. This tutorial is pretty short and to the point for what you're looking for. Also, don't worry about adding a lot of annotations, MapKit is optimized for have a large number of annotations on a map.
Lastly, you want to be able to go from an annotation to a detail view. MKAnnotationView has a property called leftCalloutAccessoryView where you can add a button. If you just want a quick and dirty fix, set the tag property on the button to the index in the array with the info for the detail view and have every button call the same selector.

showing continents programmatically in MKMapView

I have a view with 3 buttons (Europe, Asia, America) and a MKMapView.
If one of these buttons was clicked, i need to show the specific continent.
In
MKGeometry.h (Mapkit Framework)
there is a constant
MKMapRectWorld
which i can use to show the whole world.
Is there something similar for continents?
If not, what is the best way to determine all informations i need for creating a MKCoordinateRegion?
Use Google Earth or Goole Maps to work out the lat/long boundaries and then call setRegion on your map view.

How to display two annotations with the same coordinates on the map?

I have two annotations with the same coordinates. And I have to display them on the map. When I add these annotations on the map I see just one pin. How can I display two annotations instead of one? Or how can I display a annotations list by clicking on the pin? Can anybody help me?
Thanks in advance.
Igor
When you try to display multiple annotations at the same coordinate on a map using MapKit, generally it will actually place two different pins, but they will be in the exact same location. You can compare the difference in the shadow strength to see the difference, however; look at a single pin's shadow, then look at your double-pin shadow, and you should see the latter appear darker.
In terms of indicating to your user that there are multiple pins, there are several ways you could do that. You might consider implementing the title or subtitle properties on your annotations to display the number of annotations at the same coordinates (e.g. set subtitle to the string #"(and two more)" or similar). Then, when the callout accessory view is tapped, push (onto a navigation controller stack) a table view of annotations at that location.

Resources