Back to examples
beginner

Default styles

Use a variety of professionally designed styles with the Mapbox Maps SDK for iOS.

      

import Mapbox

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let mapView = MGLMapView(frame: view.bounds,
                                 styleURL: MGLStyle.outdoorsStyleURL())
        
        // Tint the ℹ️ button and the user location annotation.
        mapView.tintColor = .darkGray
        
        mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        
        // Set the map’s center coordinate and zoom level.
        mapView.setCenter(CLLocationCoordinate2D(latitude: 51.50713,
            longitude: -0.10957),
            zoomLevel: 13, animated: false)
        view.addSubview(mapView)
    }
}




      
      


#import "ViewController.h"
@import Mapbox;

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds
                                                   styleURL:[MGLStyle outdoorsStyleURL]];

    // Tint the ℹ️ button and the user location annotation.
    mapView.tintColor = [UIColor darkGrayColor];

    mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    // Set the map’s center coordinate and zoom level.
    [mapView setCenterCoordinate:CLLocationCoordinate2DMake(51.50713, -0.10957)
                       zoomLevel:13
                        animated:NO];

    [self.view addSubview:mapView];
}

@end