@@ -146,6 +146,7 @@ - (instancetype _Nonnull)initWithStyleURL:(nullable NSURL *)styleURL camera:(MLN
146146 _size = size;
147147 _camera = camera;
148148 _showsLogo = YES ;
149+ _showsAttribution = YES ;
149150#if TARGET_OS_IPHONE
150151 _scale = [UIScreen mainScreen ].scale ;
151152#else
@@ -161,6 +162,7 @@ - (nonnull id)copyWithZone:(nullable NSZone *)zone {
161162 copy.coordinateBounds = _coordinateBounds;
162163 copy.scale = _scale;
163164 copy.showsLogo = _showsLogo;
165+ copy.showsAttribution = _showsAttribution;
164166 return copy;
165167}
166168
@@ -403,22 +405,24 @@ - (void)startWithQueue:(dispatch_queue_t)queue overlayHandler:(MLNMapSnapshotOve
403405 return nil ;
404406 }
405407
406- if (options.showsLogo ) {
408+ if (options.showsLogo && logoImage ) {
407409 [logoImage drawInRect: logoImageRect];
408410 }
409411
410- UIImage *currentImage = UIGraphicsGetImageFromCurrentImageContext ();
411- CGImageRef attributionImageRef = CGImageCreateWithImageInRect ([currentImage CGImage ], cropRect);
412- UIImage *attributionImage = [UIImage imageWithCGImage: attributionImageRef];
413- CGImageRelease (attributionImageRef);
412+ if (options.showsAttribution ) {
413+ UIImage *currentImage = UIGraphicsGetImageFromCurrentImageContext ();
414+ CGImageRef attributionImageRef = CGImageCreateWithImageInRect ([currentImage CGImage ], cropRect);
415+ UIImage *attributionImage = [UIImage imageWithCGImage: attributionImageRef];
416+ CGImageRelease (attributionImageRef);
414417
415- CIImage *ciAttributionImage = [[CIImage alloc ] initWithCGImage: attributionImage.CGImage];
418+ CIImage *ciAttributionImage = [[CIImage alloc ] initWithCGImage: attributionImage.CGImage];
416419
417- UIImage *blurredAttributionBackground = [MLNMapSnapshotter blurredAttributionBackground: ciAttributionImage];
420+ UIImage *blurredAttributionBackground = [MLNMapSnapshotter blurredAttributionBackground: ciAttributionImage];
418421
419- [blurredAttributionBackground drawInRect: attributionBackgroundFrame];
422+ [blurredAttributionBackground drawInRect: attributionBackgroundFrame];
420423
421- [MLNMapSnapshotter drawAttributionTextWithStyle: attributionInfoStyle origin: attributionTextPosition attributionInfo: attributionInfo];
424+ [MLNMapSnapshotter drawAttributionTextWithStyle: attributionInfoStyle origin: attributionTextPosition attributionInfo: attributionInfo];
425+ }
422426
423427 UIImage *compositedImage = UIGraphicsGetImageFromCurrentImageContext ();
424428
@@ -478,19 +482,21 @@ - (void)startWithQueue:(dispatch_queue_t)queue overlayHandler:(MLNMapSnapshotOve
478482 return nil ;
479483 }
480484
481- if (logoImage ) {
485+ if (options. showsLogo ) {
482486 [logoImage drawInRect: logoImageRect];
483487 }
484488
485- NSBitmapImageRep *attributionBackground = [[NSBitmapImageRep alloc ] initWithFocusedViewRect: attributionBackgroundFrame];
489+ if (options.showsAttribution ) {
490+ NSBitmapImageRep *attributionBackground = [[NSBitmapImageRep alloc ] initWithFocusedViewRect: attributionBackgroundFrame];
486491
487- CIImage *attributionBackgroundImage = [[CIImage alloc ] initWithCGImage: [attributionBackground CGImage ]];
492+ CIImage *attributionBackgroundImage = [[CIImage alloc ] initWithCGImage: [attributionBackground CGImage ]];
488493
489- NSImage *blurredAttributionBackground = [MLNMapSnapshotter blurredAttributionBackground: attributionBackgroundImage];
494+ NSImage *blurredAttributionBackground = [MLNMapSnapshotter blurredAttributionBackground: attributionBackgroundImage];
490495
491- [blurredAttributionBackground drawInRect: attributionBackgroundFrame];
496+ [blurredAttributionBackground drawInRect: attributionBackgroundFrame];
492497
493- [MLNMapSnapshotter drawAttributionTextWithStyle: attributionInfoStyle origin: attributionTextPosition attributionInfo: attributionInfo];
498+ [MLNMapSnapshotter drawAttributionTextWithStyle: attributionInfoStyle origin: attributionTextPosition attributionInfo: attributionInfo];
499+ }
494500
495501 [compositedImage unlockFocus ];
496502
0 commit comments