Sorry, you need to enable JavaScript to visit this website.

Map initialization

Map initialization

The main class that represents a Map is a TTMapView. The TTMapView is an interactive world map that pans and zooms in response to gestures. Use its methods to receive map-related update messages in your application as long as they conform to the TTMapViewDelegate protocol.

The basic steps for adding a map are:

  1. Set up your project as it is described in DOWNLOADS.

  2. Create the object 'TTMapView'.

  3. Obtain the keys from Info.plist.

  4. Use the 'TTMapView' object to set the map properties.


self.mapView = TTMapView(frame: self.view.frame)
self.mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view = self.mapView
self.mapView = [[TTMapView alloc] initWithFrame:self.view.frame];
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view = self.mapView;


[Optional] Create the TTMapConfiguration object and pass it to the MapView init method. The TTMapConfiguration object allows you to configure the initial viewport and TomTom logo position.


Map configuration is an extra parameter that can be used to init a 'TTMapView'.


self.mapView = TTMapView(frame: view.bounds, mapConfiguration: mapConfig)
self.mapView = [[TTMapView alloc] initWithFrame:self.view.bounds mapConfiguration:mapConfig];


TomTom Logo

When using the Maps SDK for iOS, it is required that the TomTom logo is always visible. By default, the TomTom logo is located at the bottom-left corner of the map. However, you can easily customize its position to meet your app design by passing the TTLogoPosition object to your map configuration object.


let logoPosition = TTLogoPosition(verticalPosition: .bottom, horizontalPosition: .right)
let mapConfig = TTMapConfigurationBuilder.create().withTomTomLogoPosition(logoPosition).build()
self.mapView = TTMapView(frame: view.bounds, mapConfiguration: mapConfig)
TTLogoPosition *logoPosition = [[TTLogoPosition alloc] initWithVerticalPosition:bottom horizontalPosition:left];
TTMapConfiguration *mapConfig = [[[[TTMapConfigurationBuilder createBuilder] withViewportTransform:viewportTransform] withTomTomLogoPosition:logoPosition] build];
self.mapView = [[TTMapView alloc] initWithFrame:self.view.bounds mapConfiguration:mapConfig];



If you want to init a 'TTMapView' centered on specific place with a custom bearing and pitch, you should check the TTViewportTransform param of TTMapConfiguration.


let viewportTransform = TTCenterOnGeometryBuilder.create(withGeometry: [
        .init(latitude: 52.3274167028, longitude: 4.72924173),
        .init(latitude: 52.43106373, longitude: 5.0310596876),
        .init(latitude: 52.43106373, longitude: 4.72924173),
        .init(latitude: 52.3274167028, longitude: 4.72924173),
    ], withPadding: .zero)
let mapConfig = TTMapConfigurationBuilder.create().withViewportTransform(viewportTransform).build()
self.mapView = TTMapView(frame: view.bounds, mapConfiguration: mapConfig)
NSArray<CLLocation *> *geometry = @[[[CLLocation alloc] initWithLatitude:52.3274167028 longitude:4.72924173], [[CLLocation alloc] initWithLatitude:52.43106373 longitude:5.0310596876], [[CLLocation alloc] initWithLatitude:52.43106373 longitude:4.72924173],[[CLLocation alloc] initWithLatitude:52.3274167028 longitude:4.72924173]];
TTCenterOnGeometry *viewportTransform = [[[[TTCenterOnGeometryBuilder createWithGeometry:geometry withPadding:UIEdgeInsetsZero] withPitch:30] withBearing:-90] build];
TTMapConfiguration *mapConfig = [[[[TTMapConfigurationBuilder createBuilder] withViewportTransform:viewportTransform] build];
self.mapView = [[TTMapView alloc] initWithFrame:self.view.bounds mapConfiguration:mapConfig];




self.mapView.onMapReadyCompletion {
[self.mapView onMapReadyCompletion:^{