API overview
Use API on iOS SDK.
Map interface (VBDMapView
class)
Map interface is the basic interface that you will work, it displays a map which can zoom corresponding to the user manipulation. You can create a map by code or you can embed it in .xib
Interface Builder or .storyboard
files, like any other UIView subclass. The default is nice map style but you can change other styles by using VBDStyle
combination with styleURL
of VBDMapView
. There is also an option to control annotations on the map, restrict zoom levels and other parameters.
Map interface decentralization (VBDMapViewDelegate
)
According to Cocoa design pattern, map interface can have an optional decentralized object to help make interactive decisions. Some of these decisions include:
- Set and display other markers and annotations on the map.
- Before and after scrolling/zooming, it is possible to update an interface element when dragging the map.
- Interactive handling markers and other annotations.
Authentication key
An authentication key is required to use the service and the Vietbando API, such as maps, directions, geocodes. Your authentication keys can be managed in your account settings where you can get current key and create new one. You should create a new key for each of your applications, help you monitor usage and minimize interruptions in case a token must be revoked.
There are two ways to provide an authentication key in your application:
- In
Info.plist
file, assignVBDVietbandoAccessToken
. - In the decentralized method of application
application:didFinishLaunchingWithOptions:
, use-[VBDAccountManager setAccessToken:]
.
Location service
To display user location on a map, first you must ask their permission. In iOS 8 or later, this is done by creating and is set by two keys: NSLocationAlwaysUsageDescription
and NSLocationWhenInUseUsageDescription
in Info.plist
file.
Enable VBDMapView.showsUserLocation
will automatically ask for the necessary permissions, and once granted, will place a caption on the map at the user location.
In most cases, you will only need to provide a description key to use. If both keys are defined that the permissions have not been granted by the user, this SDK will require authentication when used. For more information on locks and location permissions in iOS in general, see comprehensive overview of NSHipster.
Map type
There are four types of maps:
- Vector Tile Default:
The attribute name is
[VBDStyle vtvbdDefaultStyleURLWithVersion:1]
. - Raster Image Default:
The attribute name is
[VBDStyle ravbdDefaultStyleURLWithVersion:1]
. - Raster Image Terrain:
The attribute name is
[VBDStyle ravbdTerrainStyleURLWithVersion:1]
. - Raster Image Admin:
The attribute name is
[VBDStyle ravbdAdminStyleURLWithVersion:1]
.