MGLStyleLayer

@interface MGLStyleLayer : NSObject

MGLStyleLayer is an abstract base class for style layers. A style layer manages the layout and appearance of content at a specific z-index in a style. An MGLStyle object consists of one or more MGLStyleLayer objects.

Each style layer defined by the style JSON file is represented at runtime by an MGLStyleLayer object, which you can use to refine the map’s appearance. You can also add and remove style layers dynamically.

Create instances of MGLBackgroundStyleLayer and the concrete subclasses of MGLForegroundStyleLayer in order to use MGLStyleLayer‘s properties and methods. You do not create instances of MGLStyleLayer directly, and do not create your own subclasses of this class.

Do not add MGLStyleLayer objects to the style property of a MGLMapView before -mapView:didFinishLoadingStyle: is called.

Identifying a Style Layer

identifier

A string that uniquely identifies the style layer in the style to which it is added.

Declaration

Objective-C

@property (nonatomic, copy, readonly) NSString *_Nonnull identifier;

Swift

var identifier: String { get }

Configuring a Style Layer’s Visibility

visible

Whether this layer is displayed. A value of NO hides the layer.

Declaration

Objective-C

@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isVisible)
BOOL visible;

Swift

var isVisible: Bool { get set }

maximumZoomLevel

The maximum zoom level at which the layer gets parsed and appears. This value is a floating-point number.

Declaration

Objective-C

@property (nonatomic, assign, unsafe_unretained, readwrite)
float maximumZoomLevel;

Swift

var maximumZoomLevel: Float { get set }

minimumZoomLevel

The minimum zoom level at which the layer gets parsed and appears. This value is a floating-point number.

Declaration

Objective-C

@property (nonatomic, assign, unsafe_unretained, readwrite)
float minimumZoomLevel;

Swift

var minimumZoomLevel: Float { get set }
iOS SDK

SDK JS Reference

On this page