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 }
  • TTStyleManager class to manage interactions with style and layers.

    Declaration

    Objective-C

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

    Swift

    var styleManager: TTStyleManager { 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. 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

  • 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 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 }
  • 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

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

  • Provides access to rendered features related to 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 layers ids for which features will be returned.

    Return Value

    TTGeoJSONFeatureCollection collection of TTGeoJSONFeatures from specified point. BETA

  • Provides access to rendered features related to passed location 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 layers ids for which features will be returned.

    Return Value

    TTGeoJSONFeatureCollection collection of TTGeoJSONFeatures from specified coordinates. BETA

  • Provides access to rendered features related to passed screen rect 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 layers ids for which features will be returned.

    Return Value

    TTGeoJSONFeatureCollection collection of TTGeoJSONFeatures from specified screen rect. BETA

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

  • The method for setting geopolitical map view

    Declaration

    Objective-C

    - (void)setGeopoliticalView:(TTGeoView)geoView;

    Swift

    func setGeopolitical(_ geoView: TTGeoView)

    Parameters

    geoView

    enumerate of TTGeoView elements

  • 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 (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()
  • 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