aboutsummaryrefslogtreecommitdiffstats
path: root/platform/ios/demo/Examples/ObjectiveC/SourceCustomVectorExample.m
blob: 069aa4ee26cc4179517c0493276a80b15b90eb36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#import "SourceCustomVectorExample.h"
@import Mapbox;

NSString *const MBXExampleSourceCustomVector = @"SourceCustomVectorExample";

@implementation SourceCustomVectorExample

- (void)viewDidLoad {
    [super viewDidLoad];

    // Third party vector tile sources can be added.
    
    // In this case we're using custom style JSON (https://www.mapbox.com/mapbox-gl-style-spec/) to add a third party tile source: <https://vector.mapzen.com/osm/all/{z}/{x}/{y}.mvt>
    NSURL *customStyleURL = [[NSBundle mainBundle] URLForResource:@"third_party_vector_style" withExtension:@"json"];

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

    mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    mapView.tintColor = [UIColor whiteColor];

    [self.view addSubview:mapView];
}

@end