Skip to main content

Mappls Pin Strategy in Mappls's Map SDK for iOS

Add Marker Using Mappls Pin

A marker on Mappls Map can be added using only Mappls Pin. For this it will require an object of MapplsPointAnnotation.

To create object of MapplsPointAnnotation it will require Mappls Mappls Pin(unique code of a Place) in its initializer.

Single Marker

Swift

let annotation11 = MapplsPointAnnotation(mapplsPin: "7gbcyf")
mapView.addMapplsAnnotation(annotation11, completionHandler: nil)

Multiple Markers

Swift

var annotations = [MapplsPointAnnotation]()            
let mapplsPins = [ "mmi000", "7gbcyf", "5MEQEL", "k595cm"]
for mapplsPin in mapplsPins {
let annotation = MapplsPointAnnotation(mapplsPin: mapplsPin)
annotations.append(annotation)
}
self.mapView.addMapplsAnnotations(annotations, completionHandler: nil)

Set Map Center Using Mappls Pin

Mappls's Map can be centered to a Place using its Mappls Pin. Different functions are available to achieve this. Below are code snippets to use it.

Swift

mapView.setMapCenterAtMapplsPin("mmi000", animated: false, completionHandler: nil)
mapView.setMapCenterAtMapplsPin("mmi000", zoomLevel: 17, animated: false, completionHandler: nil)
mapView.setMapCenterAtMapplsPin("mmi000", zoomLevel: 17, direction: 0, animated: false, completionHandler: nil)

Set Map View Bounds Using List of Mappls Pin

Mappls's Map's bounds can be set to fit bounds for a list of Mappls Pins. A method showMapplsPins: is available to achieve this. Below is code snipped to demonstrated its usage

Swift

let mapplsPins = ["mmi000", "7gbcyf", "5MEQEL", "k595cm"]
self.mapView.showMapplsPins(MapplsPins, animated: false, completionHandler: nil)

Distance Between Locations Using Mappls Pins

Code snipet for getting distance between different locations using Mappls Pins is below. For more information please see here.

Directions Between Locations Using Mappls Pins

Directions between different locations can be get using Mappls Pins. For more information please see here and here.