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.

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

    Declaration

    Objective-C

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

    Swift

    var identifier: String { get }
  • Whether this layer is displayed. A value of NO hides the layer.

    See the Show and hide a layer example to learn how to toggle an MGLStyleLayer object’s visibility.

    Declaration

    Objective-C

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

    Swift

    var isVisible: Bool { get set }
  • The maximum zoom level at which the layer gets parsed and appears. This value is a floating-point number.

    Declaration

    Objective-C

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

    Swift

    var maximumZoomLevel: Float { get set }
  • The minimum zoom level at which the layer gets parsed and appears. This value is a floating-point number.

    Declaration

    Objective-C

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

    Swift

    var minimumZoomLevel: Float { get set }