MGLBackgroundStyleLayer
@interface MGLBackgroundStyleLayer : MGLStyleLayer
An MGLBackgroundStyleLayer
is a style layer that covers the entire map. Use a
background style layer to configure a color or pattern to show below all other
map content. If the style’s other layers use the Mapbox Streets source, the
background style layer is responsible for drawing land, whereas the oceans and
other bodies of water are drawn by MGLFillStyleLayer
objects.
A background style layer is typically the bottommost layer in a style, because
it covers the entire map and can occlude any layers below it. You can therefore
access it by getting the last item in the MGLStyle.layers
array.
If the background style layer is transparent or omitted from the style, any portion of the map view that does not show another style layer is transparent.
-
Returns a background style layer initialized with an identifier.
After initializing and configuring the style layer, add it to a map view’s style using the
-[MGLStyle addLayer:]
or-[MGLStyle insertLayer:belowLayer:]
method.Declaration
Objective-C
- (nonnull instancetype)initWithIdentifier:(nonnull NSString *)identifier;
Swift
init(identifier: String)
Parameters
identifier
A string that uniquely identifies the source in the style to which it is added.
-
The color with which the background will be drawn.
The default value of this property is an
MGLStyleValue
object containingNSColor.blackColor
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
backgroundPattern
is set tonil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSColor *> *backgroundColor;
Swift
var backgroundColor: MGLStyleValue<NSColor>! { get set }
-
The transition affecting any changes to this layer’s
backgroundColor
property.This property corresponds to the
background-color-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition backgroundColorTransition;
Swift
var backgroundColorTransition: MGLTransition { get set }
-
The opacity at which the background will be drawn.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float1
. Set this property tonil
to reset it to the default value.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
Swift
var backgroundOpacity: MGLStyleValue<NSNumber>! { get set }
-
The transition affecting any changes to this layer’s
backgroundOpacity
property.This property corresponds to the
background-opacity-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition backgroundOpacityTransition;
Swift
var backgroundOpacityTransition: MGLTransition { get set }
-
Name of image in style images to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, …, 512).
You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode ofMGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSString *> *backgroundPattern;
Swift
var backgroundPattern: MGLStyleValue<NSString>! { get set }
-
The transition affecting any changes to this layer’s
backgroundPattern
property.This property corresponds to the
background-pattern-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition backgroundPatternTransition;
Swift
var backgroundPatternTransition: MGLTransition { get set }