diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-06-13 12:55:01 -0700 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-06-19 09:50:08 -0700 |
commit | 7f36e0cf769f6fe7a759b1cf6c56948c4c141fef (patch) | |
tree | 2b72187a6306df9d97d4b57007bd64c86a4bf4c7 /platform/ios/app | |
parent | b7c7d3fdab283d7bf03d8acf68b9cfd478d6973f (diff) | |
download | qtlocation-mapboxgl-7f36e0cf769f6fe7a759b1cf6c56948c4c141fef.tar.gz |
[iOS][macOS] Export `MGLImageSource`, add and update documentation. Use animated ImageSource demo in iOS test app
Diffstat (limited to 'platform/ios/app')
-rw-r--r-- | platform/ios/app/MBXViewController.m | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 756f4d5516..29c5c65012 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1317,15 +1317,33 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { { MGLCoordinateQuad coordinateQuad = { { 46.437, -80.425 }, - { 46.437, -71.516 }, + { 37.936, -80.425 }, { 37.936, -71.516 }, - { 37.936, -80.425 } }; + { 46.437, -71.516 } }; + + MGLImageSource *imageSource = [[MGLImageSource alloc] initWithIdentifier:@"style-image-source-id" coordinateQuad:coordinateQuad URL:[NSURL URLWithString:@"https://www.mapbox.com/mapbox-gl-js/assets/radar0.gif"]]; - MGLImageSource *imageSource = [[MGLImageSource alloc] initWithIdentifier:@"style-image-source-id" coordinates:coordinateQuad imageURL:[NSURL URLWithString:@"https://www.mapbox.com/mapbox-gl-js/assets/radar.gif"]]; [self.mapView.style addSource:imageSource]; MGLRasterStyleLayer *rasterLayer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"style-raster-image-layer-id" source:imageSource]; [self.mapView.style addLayer:rasterLayer]; + + [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector:@selector(updateAnimatedImageSource:) + userInfo:imageSource + repeats:YES]; +} + + +- (void)updateAnimatedImageSource:(NSTimer *)timer { + static int radarSuffix = 0; + MGLImageSource *imageSource = (MGLImageSource *)timer.userInfo; + NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.mapbox.com/mapbox-gl-js/assets/radar%d.gif", radarSuffix++]]; + [imageSource setValue:url forKey:@"URL"]; + if (radarSuffix > 3) { + radarSuffix = 0; + } } -(void)styleCountryLabelsLanguage |