MGLCameraStyleFunction

@interface MGLCameraStyleFunction <T> : MGLStyleFunction<T>

An MGLCameraStyleFunction is a value function defining a style value that changes as the zoom level changes. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLCameraStyleFunction objects. Use a camera function to create the illusion of depth and control data density.

The MGLCameraStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

  • Creates and returns an MGLCameraStyleFunction object representing a camera function with one or more stops.

    Declaration

    Objective-C

    + (nonnull instancetype)
    functionWithInterpolationMode:(MGLInterpolationMode)interpolationMode
                            stops:(nonnull NSDictionary<id, MGLStyleValue<T> *> *)
                                      stops
                          options:
                              (nullable NSDictionary<MGLStyleFunctionOption, id> *)
                                  options;

    Swift

    convenience init(interpolationMode: MGLInterpolationMode, stops: [AnyHashable : MGLStyleValue

    Parameters

    interpolationMode

    The mode used to interpolate property values between map zoom level changes.

    stops

    A dictionary associating zoom levels with style values.

    options

    A dictionary containing MGLStyleFunctionOption values that specify how a function is applied.

    Return Value

    An MGLCameraStyleFunction object with the given interpolation mode, camera stops, and options.

  • A dictionary associating zoom levels with style values.

    Each of the function’s stops is represented by one key-value pair in the dictionary. Each key in the dictionary is an NSNumber object containing a floating-point zoom level. Each value in the dictionary is an MGLStyleValue object containing the value of the style attribute when the map is at the associated zoom level. An MGLStyleFunction object may not be used recursively as a stop value.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSDictionary<id, MGLStyleValue<T> *> *_Nonnull stops;

    Swift

    var stops: [AnyHashable : MGLStyleValue