TTMapView
@interface TTMapView
An TTMapView
object provides an embeddable map interface.
You use this class as-is to display map information and to manipulate the map contents from your application.
You can center the map on a given coordinate, specify the size of the area you want to display and annotate the map with custom information.
-
Variable allow display a map with a custom style
Declaration
Objective-C
@property (getter=isCustomStyle, assign, readwrite, nonatomic) BOOL customStyle;
Swift
var isCustomStyle: Bool { get set }
-
The
TTMapViewDelegate
protocol defines a set of optional methods that you can use to receive map-related update messages.Declaration
Objective-C
@property (readwrite, nonatomic) id<TTMapViewDelegate> _Nullable delegate;
Swift
weak var delegate: TTMapViewDelegate? { get set }
-
TTAnnotationManager class to manage interactions with annotations.
Declaration
Objective-C
@property (readonly, strong, nonatomic) id<TTAnnotationManager> _Nonnull annotationManager;
Swift
var annotationManager: TTAnnotationManager { get }
-
TTRouteManager class to manage interactions with drawing routes on map.
Declaration
Objective-C
@property (readonly, strong, nonatomic) id<TTRouteManager> _Nonnull routeManager;
Swift
var routeManager: TTRouteManager { get }
-
TTTrackingManager class to manage interactions with tracking objects on map. BETA
Declaration
Objective-C
@property (readonly, strong, nonatomic) id<TTTrackingManager> _Nonnull trackingManager;
Swift
var trackingManager: TTTrackingManager { get }
-
The
TTTrafficDelegate
protocol defines a set of methods they you can use to handle traffic related events.Declaration
Objective-C
@property (readwrite, nonatomic) id<TTMapTrafficDelegate> _Nullable trafficDelegate;
Swift
weak var trafficDelegate: TTMapTrafficDelegate? { get set }
-
Initializes and returns a TTMapView with the specified frame rectangle with default style.
Declaration
Objective-C
- (instancetype _Nonnull)initWithFrame:(CGRect)frame;
Swift
init(frame: CGRect)
Parameters
frame
The frame rectangle for the view, measured in points.
Return Value
TTMapView
-
Initializes and returns a TTMapView with the specified frame rectangle.
Declaration
Objective-C
- (instancetype _Nonnull)initWithFrame:(CGRect)frame withCustomStyle:(BOOL)customStyleOn;
Swift
init(frame: CGRect, withCustomStyle customStyleOn: Bool)
Parameters
frame
The frame rectangle for the view, measured in points.
customStyleOn
customStyleOn
Return Value
TTMapView
-
Initializes and returns an TTMapView initialized from data in a given unarchiver.
Declaration
Objective-C
- (instancetype _Nonnull)initWithCoder:(NSCoder *_Nonnull)aDecoder;
Swift
init(coder aDecoder: NSCoder)
Parameters
aDecoder
An unarchiver object.
Return Value
TTMapView
-
Completion block called when the map is ready to be used.
Declaration
Objective-C
- (void)onMapReadyCompletion: (TTMapReadyCompletionBlock _Nonnull)completionBlock;
Swift
func onMapReadyCompletion(_ completionBlock: @escaping TTMapReadyCompletionBlock)
Parameters
completionBlock
completionBlock
-
Converts screen point on map to coordinate.
Declaration
Objective-C
- (CLLocationCoordinate2D)coordinateForPoint:(CGPoint)point;
Swift
func coordinate(for point: CGPoint) -> CLLocationCoordinate2D
Parameters
point
CGPoint on screen
Return Value
CLLocationCoordinate2D
-
Converts coordinate to screen point on map.
Declaration
Objective-C
- (CGPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate;
Swift
func point(for coordinate: CLLocationCoordinate2D) -> CGPoint
Parameters
coordinate
CLLocationCoordinate2D
Return Value
CGPoint
-
Returns current rotation of the map in degrees range from 0 to 360
Allows also to set rotation degrees is in range 0 - 360 where 0 == 360 which is Nort up Bigger values than 360 are also allowed. For 540 it will do 540 % 360 = 180
Declaration
Objective-C
@property (assign, readwrite, nonatomic) double bearing;
Swift
var bearing: Double { get set }
-
Determines if current location indicator/radius should be displayed on the map. It works only if users allow application to use GPS fix and NSLocationWhenInUseUsageDescription and location permissions are gained by calling requestLocationAuthorization method.
Declaration
Objective-C
@property (getter=isShowsUserLocation, assign, readwrite, nonatomic) BOOL showsUserLocation;
Swift
var isShowsUserLocation: Bool { get set }
-
Returns current user coordinate location. If the current location is not available, latitude and longitude returned by the method will be equal to 0.
Declaration
Objective-C
@property (readonly, getter=userLocation, nonatomic) CLLocationCoordinate2D userLocation;
Swift
var userLocation: CLLocationCoordinate2D { get }
-
Determines map view insets for functions like show route overview, center on, camera concept. A default set to 0.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) int contentInset;
Swift
var contentInset: Int32 { get set }
-
Disable gestures on map using gesturesMask from NS_OPTIONS
Declaration
Objective-C
@property (setter=setGestureMask:, assign, readwrite, nonatomic) TTOptionGesturesDisable disableGesturesMask;
Swift
var disableGesturesMask: TTOptionGesturesDisable { get set }
-
Online Traffic tiles types are represented in enum. It is possible to enable morethan one option at the same time. @deprecated This property is deprecated. Use the new method-based API instead. ‘trafficFlowOn’ and ‘trafficIncidentsOn’
Declaration
Objective-C
@property (assign, readwrite, nonatomic) enum TTMapTrafficType trafficType;
Swift
var trafficType: TTMapTrafficType { get set }
-
Online Traffic tiles types are represented in TTTileType.
Declaration
Objective-C
@property (readwrite, strong, nonatomic) TTTrafficTileStyle *_Nonnull trafficTileStyle;
Swift
var trafficTileStyle: TTTrafficTileStyle { get set }
-
Display traffic flow on the road.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) BOOL trafficFlowOn;
Swift
var trafficFlowOn: Bool { get set }
-
Display traffic incidents on the road.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) BOOL trafficIncidentsOn;
Swift
var trafficIncidentsOn: Bool { get set }
-
Set style of traffic incidents
Declaration
Objective-C
@property (assign, readwrite, nonatomic) TTTrafficIncidentsStyle trafficIncidentsStyle;
Swift
var trafficIncidentsStyle: TTTrafficIncidentsStyle { get set }
-
Traffic flow tiles are available in two formats: vector (.pbf) and raster (.png). Vector tiles provide apossibility for visual customization and better visual experience. Therefore, we recommend usingthe vector tiles for map and traffic display. Raster tiles are especially suitable for low performancedevices.
Vector traffic flow tiles are used by default for traffic flow in Maps SDK. Vector traffic flow tiles areavailable from map zoom levels: 11 to 20. Raster traffic flow tiles are available from map zoomlevels: 0 to 18. You can switch to raster traffic flow tiles by using the method:
@deprecated This method is deprecated. Use the new method-based API instead ‘trafficTileStyle’
Declaration
Objective-C
@property (assign, readwrite, nonatomic) TTMapTrafficTileType trafficTile;
Swift
var trafficTile: TTMapTrafficTileType { get set }
-
Close traffic callout if displayed.
Declaration
Objective-C
- (void)closeTrafficCallout;
Swift
func closeTrafficCallout()
-
Allows to display traffic detail view on map when traffic even clicked.
Declaration
Objective-C
- (void)displayTrafficCallout:(TTMapTrafficCallout *_Nonnull)callout atPosition:(CLLocationCoordinate2D)position;
Swift
func display(_ callout: TTMapTrafficCallout, atPosition position: CLLocationCoordinate2D)
Parameters
callout
TTMapTrafficCallout
position
CLLocationCoordinate2D
-
- Center map on given coordinates
Declaration
Objective-C
- (void)centerOnCoordinate:(CLLocationCoordinate2D)coordinate;
Swift
func center(on coordinate: CLLocationCoordinate2D)
Parameters
coordinate
location Coordinate to center map on.
-
- Center map on given latitude and longitude.
- Latitude and longitude is set in degrees minutes seconds format.
Declaration
Objective-C
- (void)centerOnLatitude:(double)latitude withLongitude:(double)longitude;
Swift
func center(onLatitude latitude: Double, withLongitude longitude: Double)
Parameters
latitude
Latitude to center map on.
longitude
Longitude to center map on.
-
- Center map on given coordinates and with given zoom level.
- When zoom level is out of range, the minimum zoom level will be set.
Declaration
Objective-C
- (void)centerOnCoordinate:(CLLocationCoordinate2D)coordinate withZoom:(double)zoom;
Swift
func center(on coordinate: CLLocationCoordinate2D, withZoom zoom: Double)
Parameters
coordinate
Coordinate to center map on.
zoom
Map zoom level in range 0 - 18 where 0 is whole world and 18 highest zoom level.
-
- Center map on given latitude and longitude with a given zoom level.
- When zoom level is out of range, the minimum zoom level will be set.
- Latitude and longitude are set in degrees minutes seconds format.
Declaration
Objective-C
- (void)centerOnLatitude:(double)latitude withLongitude:(double)longitude withZoom:(double)zoom;
Swift
func center(onLatitude latitude: Double, withLongitude longitude: Double, withZoom zoom: Double)
Parameters
latitude
Latitude to center map on.
longitude
Longitude to center map on.
zoom
Map zoom level in range 0 - 18 where 0 is whole world and 18 highest zoom level.
-
- Coordinates of map center
Declaration
Objective-C
- (CLLocationCoordinate2D)centerCoordinate;
Swift
func centerCoordinate() -> CLLocationCoordinate2D
Return Value
map center coordinate
-
- The zoom in and out of the map.
- Zoom levels are in range <18,0)
- Where 0 is whole world.
- 18 is the highest zoom level.
Declaration
Objective-C
- (double)zoom;
Swift
func zoom() -> Double
Return Value
zoom Map Level.
-
- Centers map to have all provided annotations in bounding box
Declaration
Objective-C
- (void)zoomToAnnotations:(NSArray<TTAnnotation *> *_Nonnull)annotations;
Swift
func zoom(to annotations: [TTAnnotation])
Parameters
annotations
annotations
-
- Centers map to have all provided coordiantesData in bounding box
Declaration
Objective-C
- (void)zoomToCoordinatesData:(id _Nonnull)coordinatesData;
Swift
func zoom(toCoordinatesData coordinatesData: Any)
Parameters
coordinatesData
coordinatesData
-
- Centers map to have all provided coordiantesData in bounding box
Declaration
Objective-C
- (void)zoomToCoordinatesDataCollection:(NSArray<id> *_Nonnull)coordinatesData;
Swift
func zoom(toCoordinatesDataCollection coordinatesData: [Any])
Parameters
coordinatesData
coordinatesData
-
- Set 2D mode or 3D for a map.
Declaration
Objective-C
- (void)setPerspective3D:(BOOL)perspective;
Swift
func setPerspective3D(_ perspective: Bool)
Parameters
perspective
true if 3D mode, false otherwise.
-
- Is perspective 3D active.
Declaration
Objective-C
- (BOOL)isPerspective3D;
Swift
func isPerspective3D() -> Bool
Return Value
BOOL true if a 3D mode is active, false otherwise.
-
Rotate map to given degrees with given rotation center. Degrees is in range 0 - 360 where 0 == 360 which is Nort up Bigger values than 360 are also allowed. For 540 it will do 540 % 360 = 180
Declaration
Objective-C
- (void)setBearing:(double)degrees coordinate:(CLLocationCoordinate2D)coordinate;
Swift
func setBearing(_ degrees: Double, coordinate: CLLocationCoordinate2D)
Parameters
degrees
determines how to rotate map
coordinate
that takes as center of rotation
-
The method for style to be used to render tiles.
Declaration
Objective-C
- (void)setTilesType:(TTMapTilesType)tiles;
Swift
func setTilesType(_ tiles: TTMapTilesType)
Parameters
tiles
TTMapTilesType visible for None, Vector or Raster type.
-
The method for style to be used to render layers.
Declaration
Objective-C
- (void)setLayersType:(TTMapLayersType)layers;
Swift
func setLayersType(_ layers: TTMapLayersType)
Parameters
layers
TTMapLayersType visible for None or Hybrid.
-
Get Current screen bounds
Declaration
Objective-C
- (id)currentBounds;
Swift
func currentBounds() -> Any!
Return Value
TTLatLngBounds
-
The method for setting camera position
Declaration
Objective-C
- (void)setCameraPosition:(TTCameraPosition *_Nonnull)cameraPosition;
Swift
func setCameraPosition(_ cameraPosition: TTCameraPosition)
Parameters
cameraPosition
object TTCameraPosition
-
Get Camera Position object.
Declaration
Objective-C
- (TTCameraPosition *_Nonnull)cameraPosition;
Swift
func cameraPosition() -> TTCameraPosition
Return Value
TTCameraPostion object present current state of camera.
-
@deprecated This method is deprecated, use setLanguage:(NSString* _Nullable)language instead.
Declaration
Objective-C
- (void)setMapLanguage:(id)language;
Swift
func setMapLanguage(_ language: Any!)
-
Changes labels language displayed on map to given language.
Declaration
Objective-C
- (void)setLanguage:(NSString *_Nullable)language;
Swift
func setLanguage(_ language: String?)
Parameters
language
List of supported languages: https://developer.tomtom.com/maps-api/maps-api-documentation-vector/tile#defaultViewMapping
-
Changes labels language displayed on map to unified. Labels in given contry will be displayed using local language.
Declaration
Objective-C
- (void)setUnifiedMapLanguage;
Swift
func setUnifiedMapLanguage()
-
Path Style of the style currently displayed in the map.
Declaration
Objective-C
- (void)setStylePath:(NSString *_Nullable)pathStyle;
Swift
func setStylePath(_ pathStyle: String?)
Parameters
pathStyle
If you set pathStyle to nil, the receiver will use the default style and this property will automatically be set to that path Style and load.
-
Moving the map relative to the x, y axis
Declaration
Objective-C
- (void)movebyOffsetX:(double)offsetX offsetY:(double)offsetY;
Swift
func movebyOffsetX(_ offsetX: Double, offsetY: Double)
Parameters
offsetX
Offset relative to the x axis
offsetY
Offset relative to the y axis
-
Obtains the minimal zoom level which can be set for the map.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) double minZoom;
Swift
var minZoom: Double { get set }
-
Obtains the maximum zoom level which can be set for the map.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) double maxZoom;
Swift
var maxZoom: Double { get set }
-
Obtains the maximum bounds which can be set for the map view port.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) int maxBounds;
Swift
var maxBounds: Int32 { get set }
-
Obtains the default minimum and maximum zoom level which can be set for the map.
Declaration
Objective-C
- (void)setDefaultLimitZoom;
Swift
func setDefaultLimitZoom()
-
Obtains the default bounds which can be set for the map view port.
Declaration
Objective-C
- (void)setDefaultMaxBounds;
Swift
func setDefaultMaxBounds()
-
Allows to read TTMatchingDataSet
Declaration
Objective-C
- (id)dataSet;
Swift
func dataSet() -> Any!
Return Value
TTMatchingDataSet