TTMapView

Objective-C

@interface TTMapView

Swift

class 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.

  • DEPRECATED

    • This property is deprecated. Please use initWithMapConfiguration:TTMapConfiguration together with TTMapStyleConfiguration.
    • The planned withdrawal date is 08.06.2021.

    Variable that allows the display of a map with a custom style.

    Declaration

    Objective-C

    @property (nonatomic, getter=isCustomStyle) 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 (nonatomic, weak) id<TTMapViewDelegate> _Nullable delegate;

    Swift

    weak var delegate: TTMapViewDelegate? { get set }
  • TTAnnotationManager class to manage interactions with annotations.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) id<TTAnnotationManager> _Nonnull annotationManager;

    Swift

    var annotationManager: TTAnnotationManager { get }
  • TTRouteManager class to manage interactions with drawing routes on map.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) id<TTRouteManager> _Nonnull routeManager;

    Swift

    var routeManager: TTRouteManager { get }
  • TTTrackingManager class to manage interactions with tracking objects on a map.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) id<TTTrackingManager> _Nonnull trackingManager;

    Swift

    var trackingManager: TTTrackingManager { get }
  • TTStyleManager class to manage interactions with style and layers.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) id<TTStyleManager> _Nonnull styleManager;

    Swift

    var styleManager: TTStyleManager { get }
  • The TTTrafficDelegate protocol defines a set of methods that you can use to handle traffic related events.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<TTMapTrafficDelegate> _Nullable trafficDelegate;

    Swift

    weak var trafficDelegate: TTMapTrafficDelegate? { get set }
  • Provides access to the classes allowing manipulation of the POIs (Points Of Interest) displayed on the map.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) TTPOIDisplay *_Nonnull poiDisplay;

    Swift

    var poiDisplay: TTPOIDisplay { get }
  • Initializes and returns a TTMapView with the specified frame rectangle and with the 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. Custom TTMapConfiguration can be created using TTMapConfigurationBuilder.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithMapConfiguration:
        (TTMapConfiguration *_Nonnull)configuration;

    Swift

    init(mapConfiguration configuration: TTMapConfiguration)

    Parameters

    configuration

    Map configuration

    Return Value

    TTMapView

  • Initializes and returns a TTMapView with the specified frame rectangle. Custom TTMapConfiguration can be created using TTMapConfigurationBuilder.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithFrame:(CGRect)frame
                          mapConfiguration:
                              (TTMapConfiguration *_Nonnull)configuration;

    Swift

    init(frame: CGRect, mapConfiguration configuration: TTMapConfiguration)

    Parameters

    frame

    The frame rectangle for the view, measured in points.

    configuration

    Map configuration

    Return Value

    TTMapView

  • DEPRECATED

    • This method is deprecated. Please use initWithMapConfiguration:TTMapConfiguration together with TTMapStyleConfiguration.
    • The planned withdrawal date is 08.06.2021.

    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 the coordinate to a screen point on the map.

    Declaration

    Objective-C

    - (CGPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate;

    Swift

    func point(for coordinate: CLLocationCoordinate2D) -> CGPoint

    Parameters

    coordinate

    CLLocationCoordinate2D

    Return Value

    CGPoint

  • Returns the current rotation of the map in degrees with a range from 0 to 360.

    Default bearing. For instance, 90* sets east as the up direction. Only applies if the map has not been positioned by any other means (e.g., user interaction).

    Declaration

    Objective-C

    @property (nonatomic) double bearing;

    Swift

    var bearing: Double { get set }
  • It only works if users allow the application to use the GPS fix and NSLocationWhenInUseUsageDescription, and location permissions are gained by calling the requestLocationAuthorization method.

    Declaration

    Objective-C

    @property (nonatomic) TTUserTrackingMode trackingMode;

    Swift

    var trackingMode: TTUserTrackingMode { 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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isShowsUserLocation) BOOL showsUserLocation;

    Swift

    var isShowsUserLocation: Bool { get set }
  • Returns the 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 (nonatomic, readonly, getter=userLocation) 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 (nonatomic) int contentInset;

    Swift

    var contentInset: Int32 { get set }
  • Disable gestures on map using gesturesMask from NS_OPTIONS

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              setter=setGestureMask:) TTOptionGesturesDisable disableGesturesMask;

    Swift

    var disableGesturesMask: TTOptionGesturesDisable { get set }
  • DEPRECATED

    • This property is deprecated. Use the method from TTStyleManager loadStyleFromUrl or loadStyleFromJson, the property currentStyle, and methods from TTMapStyle.
    • The planned withdrawal date is 08.06.2021.

    Online Traffic tiles types are represented in TTTileType.

    Declaration

    Objective-C

    @property (nonatomic, strong) TTTrafficTileStyle *_Nonnull trafficTileStyle;

    Swift

    var trafficTileStyle: TTTrafficTileStyle { get set }
  • Display traffic flow on the road.

    Declaration

    Objective-C

    @property (nonatomic) BOOL trafficFlowOn;

    Swift

    var trafficFlowOn: Bool { get set }
  • Display traffic incidents on the road.

    Declaration

    Objective-C

    @property (nonatomic) BOOL trafficIncidentsOn;

    Swift

    var trafficIncidentsOn: Bool { get set }
  • DEPRECATED

    • This property is deprecated. Use the method from TTStyleManager loadStyleFromUrl or loadStyleFromJson, the property currentStyle, and methods from TTMapStyle.
    • The planned withdrawal date is 08.06.2021.

    Set style of traffic incidents

    Declaration

    Objective-C

    @property (nonatomic) TTTrafficIncidentsStyle trafficIncidentsStyle;

    Swift

    var trafficIncidentsStyle: TTTrafficIncidentsStyle { get set }
  • Close traffic callout if displayed.

    Declaration

    Objective-C

    - (void)closeTrafficCallout;

    Swift

    func closeTrafficCallout()
  • Allows you to display a traffic detail view on a map when traffic is 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

  • DEPRECATED

    • This method is deprecated.
    • The planned withdrawal date is 08.06.2021.

    On map more than one traffic incident can have same ID. ID is shared among incident pois and flows. Method returns all incidetns with same ID. e.g. having ID flow you can find corresponding poi.

    Declaration

    Objective-C

    - (TTTrafficIncidentDataHolder *_Nonnull)findTrafficIncidentDataWithId:
        (NSInteger)ID;

    Swift

    func findTrafficIncidentData(withId ID: Int) -> TTTrafficIncidentDataHolder

    Parameters

    ID

    NSInteger

    Return Value

    TTTrafficIncidentDataHolder

    • 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. Default bearing. For instance, 90o sets east as the up direction. Only applies if the map has not been positioned by any other means (e.g., user interaction).

    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

  • DEPRECATED

    • This method is deprecated. This method is deprecated. Use the method from TTStyleManager loadStyleFromUrl or loadStyleFromJson with proper style with raster or vector represtation. Please check our example app class: MapTilesViewController.
    • The planned withdrawal date is 08.06.2021.

    Declaration

    Objective-C

    - (void)setTilesType:(TTMapTilesType)tiles;

    Swift

    func setTilesType(_ tiles: TTMapTilesType)
  • 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.

  • Provides access to rendered features related to a passed screen point within specified layers.

    Declaration

    Objective-C

    - (id)featuresAtPoint:(CGPoint)point
        inStyleLayerIdentifiers:(NSSet<NSString *> *_Nonnull)layerIds;

    Swift

    func features(at point: CGPoint, inStyleLayerIdentifiers layerIds: Set<String>) -> Any!

    Parameters

    point

    Screen point from which features will be extracted.

    layerIds

    Set of layer ids for which features will be returned.

    Return Value

    TTGeoJSONFeatureCollection collection of TTGeoJSONFeatures from specified point.

  • Provides access to rendered features related to a passed screen point within specified layers.

    Declaration

    Objective-C

    - (id)featuresAtCoordinates:(CLLocationCoordinate2D)coordinate
        inStyleLayerIdentifiers:(NSSet<NSString *> *_Nonnull)layerIds;

    Swift

    func features(atCoordinates coordinate: CLLocationCoordinate2D, inStyleLayerIdentifiers layerIds: Set<String>) -> Any!

    Parameters

    coordinate

    Coordinates from which features will be extracted.

    layerIds

    Set of layer ids for which features will be returned.

    Return Value

    TTGeoJSONFeatureCollection collection of TTGeoJSONFeatures from specified coordinates.

  • Provides access to rendered features related to a passed screen point within specified layers.

    Declaration

    Objective-C

    - (id)featuresAtScreenRect:(CGRect)screenRect
        inStyleLayerIdentifiers:(NSSet<NSString *> *_Nonnull)layerIds;

    Swift

    func features(atScreenRect screenRect: CGRect, inStyleLayerIdentifiers layerIds: Set<String>) -> Any!

    Parameters

    screenRect

    Screen rect from which features will be extracted.

    layerIds

    Set of layer ids for which features will be returned.

    Return Value

    TTGeoJSONFeatureCollection collection of TTGeoJSONFeatures from specified screen rect.

  • Get Current screen bounds

    Declaration

    Objective-C

    - (id)currentBounds;

    Swift

    func currentBounds() -> Any!

    Return Value

    TTLatLngBounds

  • The method for setting camera configuration. Please use TTCameraPositionBuilder or TTCameraBoundingBoxBuilder to create an instance of TTCameraConfiguration.

    Declaration

    Objective-C

    - (void)setCameraPosition:(id<TTCameraConfiguration> _Nonnull)cameraPosition;

    Swift

    func setCameraPosition(_ cameraPosition: TTCameraConfiguration)

    Parameters

    cameraPosition

    The TTCameraPosition or TTCameraBoundingBox object.

  • Get Camera Position object.

    Declaration

    Objective-C

    - (TTCameraPosition *_Nonnull)cameraPosition;

    Swift

    func cameraPosition() -> TTCameraPosition

    Return Value

    TTCameraPostion The object present with the current state of the camera.

  • DEPRECATED

    • This method is deprecated. Use method setGeopoliticalViewLocal:(NSString *_Nonnull) instead.
    • The planned withdrawal date is 08.06.2021.

    Declaration

    Objective-C

    - (void)setGeopoliticalView:(TTGeoView)geoView;

    Swift

    func setGeopolitical(_ geoView: TTGeoView)
  • The method for setting geopolitical map view

    Declaration

    Objective-C

    - (void)setGeopoliticalViewLocal:(NSString *_Nonnull)localView;

    Swift

    func setGeopoliticalViewLocal(_ localView: String)

    Parameters

    localView

    string of geoView infromation, List of supported GeopoliticalView: https://developer.tomtom.com/maps-api/maps-api-documentation-vector/tile

  • Changes labels language displayed on map to given language.

    Declaration

    Objective-C

    - (void)setLanguage:(NSString *_Nullable)language;

    Swift

    func setLanguage(_ language: String?)
  • 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()
  • Sets the path of the style used to display the map and reloads the style asynchronously.

    @remark This is an asynchronous operation. The user of this API needs to ensure that no methods of the TTMapStyle interface are called before the style is reloaded. didFinishLoadingStyle callback from the TTMapViewDelegate is called when the reloading of the style is finished.

    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.

  • Sets the JSON content of the style used to display the map and reloads the style asynchronously.

    @remark This is an asynchronous operation. The user of this API needs to ensure that no methods of the TTMapStyle interface are called before the style is reloaded. didFinishLoadingStyle callback from the TTMapViewDelegate is called when the reloading of the style is finished.

    Declaration

    Objective-C

    - (void)setStyleJSON:(nonnull NSString *)jsonStyle;

    Swift

    func setStyleJSON(_ jsonStyle: String)

    Parameters

    pathStyle

    The style in the json format.

  • 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 (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 (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 (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()
  • Sets the content the given content insets and updates camera possition if animated.

    Declaration

    Objective-C

    - (void)setContentInset:(id)contentInset animated:(BOOL)animated;

    Swift

    func setContentInset(_ contentInset: Any!, animated: Bool)
  • Change TomTom logo to default colors in which text is black.

    Declaration

    Objective-C

    - (void)applyDefaultLogo;

    Swift

    func applyDefaultLogo()
  • Change TomTom logo to inverted mode in which text is white.

    Declaration

    Objective-C

    - (void)applyInvertedLogo;

    Swift

    func applyInvertedLogo()
  • Allows to read TTMatchingDataSet

    Declaration

    Objective-C

    - (id)dataSet;

    Swift

    func dataSet() -> Any!

    Return Value

    TTMatchingDataSet

  • A method generates a static images UIImage of the map view. It starts the method snapshot by returning UIImage or Nil if this is impossible.

    Declaration

    Objective-C

    - (id)snapshotWithoutViews:(NSArray *_Nullable)views;

    Swift

    func snapshotWithoutViews(_ views: [Any]?) -> Any!

    Parameters

    views

    Views that are in the map hierarchy which we do not want to be on the snapshot.