MGLSymbolStyleLayer
@interface MGLSymbolStyleLayer : MGLVectorStyleLayer
An MGLSymbolStyleLayer
is a style layer that renders icon and text labels at
points or along lines on the map.
Use a symbol style layer to configure the visual appearance of labels for
features in vector tiles loaded by an MGLVectorSource
object or MGLShape
or
MGLFeature
instances in an MGLShapeSource
object.
You can access an existing symbol style layer using the
-[MGLStyle layerWithIdentifier:]
method if you know its identifier;
otherwise, find it using the MGLStyle.layers
property. You can also create a
new symbol style layer and add it to the style using a method such as
-[MGLStyle addLayer:]
.
Example
let layer = MGLSymbolStyleLayer(identifier: "coffeeshops", source: pois)
layer.sourceLayerIdentifier = "pois"
layer.iconImageName = MGLStyleValue(rawValue: "coffee")
layer.iconScale = MGLStyleValue(rawValue: 0.5)
layer.text = MGLStyleValue(rawValue: "{name}")
layer.textTranslation = MGLStyleValue(rawValue: NSValue(cgVector: CGVector(dx: 10, dy: 0)))
layer.textJustification = MGLStyleValue(rawValue: NSValue(mglTextJustification: .left))
layer.textAnchor = MGLStyleValue(rawValue: NSValue(mglTextAnchor: .left))
layer.predicate = NSPredicate(format: "%K == %@", "venue-type", "coffee")
mapView.style?.addLayer(layer)
-
Returns a symbol style layer initialized with an identifier and source.
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 source:(nonnull MGLSource *)source;
Swift
init(identifier: String, source: MGLSource)
Parameters
identifier
A string that uniquely identifies the source in the style to which it is added.
source
The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.
Return Value
An initialized foreground style layer.
-
If true, the icon will be visible even if it collides with other previously drawn symbols.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
icon-allow-overlap
layout property in the Mapbox Style Specification.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<NSNumber *> *iconAllowsOverlap;
Swift
var iconAllowsOverlap: MGLStyleValue
-
If true, other symbols can be visible even if they collide with the icon.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
icon-ignore-placement
layout property in the Mapbox Style Specification.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<NSNumber *> *iconIgnoresPlacement;
Swift
var iconIgnoresPlacement: MGLStyleValue
-
Name of image in sprite to use for drawing an image background. A string with {tokens} replaced, referencing the data property to pull from.
This attribute corresponds to the
icon-image
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSString *> *iconImageName;
Swift
var iconImageName: MGLStyleValue
-
Offset distance of icon from its anchor.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containing aCGVector
struct set to 0 rightward and 0 upward. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconOffset;
Swift
var iconOffset: MGLStyleValue
-
If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
, andtext
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode ofMGLInterpolationModeInterval
Declaration
Objective-C
@property (getter=isIconOptional, assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconOptional;
Swift
var iconOptional: MGLStyleValue
-
Size of the additional area around the icon bounding box used for detecting symbol collisions.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float2
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. 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<NSNumber *> *iconPadding;
Swift
var iconPadding: MGLStyleValue
-
Rotates the icon clockwise.
This property is measured in degrees.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
icon-rotate
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconRotation;
Swift
var iconRotation: MGLStyleValue
-
In combination with
symbolPlacement
, determines the rotation behavior of icons.The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLIconRotationAlignmentAuto
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.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<NSValue *> *iconRotationAlignment;
Swift
var iconRotationAlignment: MGLStyleValue
-
Scale factor for icon. 1 is original size, 3 triples the size.
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.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
icon-size
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconScale;
Swift
var iconScale: MGLStyleValue
-
Scales the icon to fit around the associated text.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLIconTextFitNone
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
, andtext
is non-nil
. Otherwise, it is ignored.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<NSValue *> *iconTextFit;
Swift
var iconTextFit: MGLStyleValue
-
Size of the additional area added to dimensions determined by
iconTextFit
.This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingNSEdgeInsetsZero
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
, andtext
is non-nil
, andiconTextFit
is set to anMGLStyleValue
object containing anNSValue
object containingMGLIconTextFitBoth
,MGLIconTextFitWidth
, orMGLIconTextFitHeight
. 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<NSValue *> *iconTextFitPadding;
Swift
var iconTextFitPadding: MGLStyleValue
-
If true, the icon may be flipped to prevent it from being rendered upside-down.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
, andiconRotationAlignment
is set to anMGLStyleValue
object containing anNSValue
object containingMGLIconRotationAlignmentMap
, andsymbolPlacement
is set to anMGLStyleValue
object containing anNSValue
object containingMGLSymbolPlacementLine
. Otherwise, it is ignored.This attribute corresponds to the
icon-keep-upright
layout property in the Mapbox Style Specification.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<NSNumber *> *keepsIconUpright;
Swift
var keepsIconUpright: MGLStyleValue
-
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingYES
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
, andtextRotationAlignment
is set to anMGLStyleValue
object containing anNSValue
object containingMGLTextRotationAlignmentMap
, andsymbolPlacement
is set to anMGLStyleValue
object containing anNSValue
object containingMGLSymbolPlacementLine
. Otherwise, it is ignored.This attribute corresponds to the
text-keep-upright
layout property in the Mapbox Style Specification.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<NSNumber *> *keepsTextUpright;
Swift
var keepsTextUpright: MGLStyleValue
-
Maximum angle change between adjacent characters.
This property is measured in degrees.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float45
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
, andsymbolPlacement
is set to anMGLStyleValue
object containing anNSValue
object containingMGLSymbolPlacementLine
. Otherwise, it is ignored.This attribute corresponds to the
text-max-angle
layout property in the Mapbox Style Specification.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 *> *maximumTextAngle;
Swift
var maximumTextAngle: MGLStyleValue
-
The maximum line width for text wrapping.
This property is measured in ems.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float10
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-max-width
layout property in the Mapbox Style Specification.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 *> *maximumTextWidth;
Swift
var maximumTextWidth: MGLStyleValue
-
If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don’t have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This attribute corresponds to the
symbol-avoid-edges
layout property in the Mapbox Style Specification.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<NSNumber *> *symbolAvoidsEdges;
Swift
var symbolAvoidsEdges: MGLStyleValue
-
Label placement relative to its geometry.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLSymbolPlacementPoint
. 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 ofMGLInterpolationModeInterval
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSValue *> *symbolPlacement;
Swift
var symbolPlacement: MGLStyleValue
-
Distance between two symbol anchors.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float250
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
symbolPlacement
is set to anMGLStyleValue
object containing anNSValue
object containingMGLSymbolPlacementLine
. 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<NSNumber *> *symbolSpacing;
Swift
var symbolSpacing: MGLStyleValue
-
Value to use for a text label. Feature properties are specified using tokens like {field_name}. (Token replacement is only supported for literal
textField
values–not for property functions.)The default value of this property is an
MGLStyleValue
object containing the empty string. Set this property tonil
to reset it to the default value.This attribute corresponds to the
text-field
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSString *> *text;
Swift
var text: MGLStyleValue
-
If true, the text will be visible even if it collides with other previously drawn symbols.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-allow-overlap
layout property in the Mapbox Style Specification.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<NSNumber *> *textAllowsOverlap;
Swift
var textAllowsOverlap: MGLStyleValue
-
Part of the text placed closest to the anchor.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLTextAnchorCenter
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.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<NSValue *> *textAnchor;
Swift
var textAnchor: MGLStyleValue
-
An array of font face names used to display the text.
Each font name must be included in the
{fontstack}
portion of the JSON stylesheet’sglyphs
property. You can register a custom font when designing the style in Mapbox Studio. Fonts installed on the system are not used.The first font named in the array is applied to the text. For each character in the text, if the first font lacks a glyph for the character, the next font is applied as a fallback, and so on.
The default value of this property is an
MGLStyleValue
object containing the arrayOpen Sans Regular
,Arial Unicode MS Regular
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-font
layout property in the Mapbox Style Specification.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<NSArray<NSString *> *> *textFontNames;
Swift
var textFontNames: MGLStyleValue
-
Font size.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float16
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-size
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textFontSize;
Swift
var textFontSize: MGLStyleValue
-
If true, other symbols can be visible even if they collide with the text.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-ignore-placement
layout property in the Mapbox Style Specification.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<NSNumber *> *textIgnoresPlacement;
Swift
var textIgnoresPlacement: MGLStyleValue
-
Text justification options.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLTextJustificationCenter
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-justify
layout property in the Mapbox Style Specification.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<NSValue *> *textJustification;
Swift
var textJustification: MGLStyleValue
-
Text tracking amount.
This property is measured in ems.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. 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<NSNumber *> *textLetterSpacing;
Swift
var textLetterSpacing: MGLStyleValue
-
Text leading value for multi-line text.
This property is measured in ems.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float1.2
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. 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<NSNumber *> *textLineHeight;
Swift
var textLineHeight: MGLStyleValue
-
Offset distance of text from its anchor.
This property is measured in ems.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containing aCGVector
struct set to 0 ems rightward and 0 ems upward. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSValue *> *textOffset;
Swift
var textOffset: MGLStyleValue
-
If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containingNO
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
, andiconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode ofMGLInterpolationModeInterval
Declaration
Objective-C
@property (getter=isTextOptional, assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOptional;
Swift
var textOptional: MGLStyleValue
-
Size of the additional area around the text bounding box used for detecting symbol collisions.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float2
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. 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<NSNumber *> *textPadding;
Swift
var textPadding: MGLStyleValue
-
Orientation of text when map is pitched.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLTextPitchAlignmentAuto
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.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<NSValue *> *textPitchAlignment;
Swift
var textPitchAlignment: MGLStyleValue
-
Rotates the text clockwise.
This property is measured in degrees.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-rotate
layout property in the Mapbox Style Specification.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textRotation;
Swift
var textRotation: MGLStyleValue
-
In combination with
symbolPlacement
, determines the rotation behavior of the individual glyphs forming the text.The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLTextRotationAlignmentAuto
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.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<NSValue *> *textRotationAlignment;
Swift
var textRotationAlignment: MGLStyleValue
-
Specifies how to capitalize text.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLTextTransformNone
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTransform;
Swift
var textTransform: MGLStyleValue
-
The tint color to apply to the icon. The
iconImageName
property must be set to a template image.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
iconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSColor *> *iconColor;
Swift
var iconColor: MGLStyleValue
-
The transition affecting any changes to this layer’s
iconColor
property.This property corresponds to the
icon-color-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition iconColorTransition;
Swift
var iconColorTransition: MGLTransition { get set }
-
Fade out the halo towards the outside.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloBlur;
Swift
var iconHaloBlur: MGLStyleValue
-
The transition affecting any changes to this layer’s
iconHaloBlur
property.This property corresponds to the
icon-halo-blur-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition iconHaloBlurTransition;
Swift
var iconHaloBlurTransition: MGLTransition { get set }
-
The color of the icon’s halo. The
iconImageName
property must be set to a template image.The default value of this property is an
MGLStyleValue
object containingNSColor.clearColor
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSColor *> *iconHaloColor;
Swift
var iconHaloColor: MGLStyleValue
-
The transition affecting any changes to this layer’s
iconHaloColor
property.This property corresponds to the
icon-halo-color-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition iconHaloColorTransition;
Swift
var iconHaloColorTransition: MGLTransition { get set }
-
Distance of halo to the icon outline.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloWidth;
Swift
var iconHaloWidth: MGLStyleValue
-
The transition affecting any changes to this layer’s
iconHaloWidth
property.This property corresponds to the
icon-halo-width-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition iconHaloWidthTransition;
Swift
var iconHaloWidthTransition: MGLTransition { get set }
-
The opacity at which the icon 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.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconOpacity;
Swift
var iconOpacity: MGLStyleValue
-
The transition affecting any changes to this layer’s
iconOpacity
property.This property corresponds to the
icon-opacity-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition iconOpacityTransition;
Swift
var iconOpacityTransition: MGLTransition { get set }
-
Distance that the icon’s anchor is moved from its original placement.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containing aCGVector
struct set to 0 points rightward and 0 points upward. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
icon-translate
layout property in the Mapbox Style Specification.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<NSValue *> *iconTranslation;
Swift
var iconTranslation: MGLStyleValue
-
The transition affecting any changes to this layer’s
iconTranslation
property.This property corresponds to the
icon-translate-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition iconTranslationTransition;
Swift
var iconTranslationTransition: MGLTransition { get set }
-
Controls the translation reference point.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLIconTranslationAnchorMap
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
iconImageName
is non-nil
, andiconTranslation
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
icon-translate-anchor
layout property in the Mapbox Style Specification.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<NSValue *> *iconTranslationAnchor;
Swift
var iconTranslationAnchor: MGLStyleValue
-
The color with which the text 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
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSColor *> *textColor;
Swift
var textColor: MGLStyleValue
-
The transition affecting any changes to this layer’s
textColor
property.This property corresponds to the
text-color-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition textColorTransition;
Swift
var textColorTransition: MGLTransition { get set }
-
The halo’s fadeout distance towards the outside.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloBlur;
Swift
var textHaloBlur: MGLStyleValue
-
The transition affecting any changes to this layer’s
textHaloBlur
property.This property corresponds to the
text-halo-blur-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition textHaloBlurTransition;
Swift
var textHaloBlurTransition: MGLTransition { get set }
-
The color of the text’s halo, which helps it stand out from backgrounds.
The default value of this property is an
MGLStyleValue
object containingNSColor.clearColor
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSColor *> *textHaloColor;
Swift
var textHaloColor: MGLStyleValue
-
The transition affecting any changes to this layer’s
textHaloColor
property.This property corresponds to the
text-halo-color-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition textHaloColorTransition;
Swift
var textHaloColorTransition: MGLTransition { get set }
-
Distance of halo to the font outline. Max text halo width is ¼ of the font-size.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSNumber
object containing the float0
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloWidth;
Swift
var textHaloWidth: MGLStyleValue
-
The transition affecting any changes to this layer’s
textHaloWidth
property.This property corresponds to the
text-halo-width-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition textHaloWidthTransition;
Swift
var textHaloWidthTransition: MGLTransition { get set }
-
The opacity at which the text 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.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.You can set this property to an instance of:
MGLConstantStyleValue
MGLCameraStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLSourceStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
MGLInterpolationModeIdentity
MGLCompositeStyleFunction
with an interpolation mode of:MGLInterpolationModeExponential
MGLInterpolationModeInterval
MGLInterpolationModeCategorical
Declaration
Objective-C
@property (assign, readwrite, nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOpacity;
Swift
var textOpacity: MGLStyleValue
-
The transition affecting any changes to this layer’s
textOpacity
property.This property corresponds to the
text-opacity-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition textOpacityTransition;
Swift
var textOpacityTransition: MGLTransition { get set }
-
Distance that the text’s anchor is moved from its original placement.
This property is measured in points.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containing aCGVector
struct set to 0 points rightward and 0 points upward. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-translate
layout property in the Mapbox Style Specification.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<NSValue *> *textTranslation;
Swift
var textTranslation: MGLStyleValue
-
The transition affecting any changes to this layer’s
textTranslation
property.This property corresponds to the
text-translate-transition
property in the style JSON file format.Declaration
Objective-C
@property (assign, readwrite, nonatomic) MGLTransition textTranslationTransition;
Swift
var textTranslationTransition: MGLTransition { get set }
-
Controls the translation reference point.
The default value of this property is an
MGLStyleValue
object containing anNSValue
object containingMGLTextTranslationAnchorMap
. Set this property tonil
to reset it to the default value.This property is only applied to the style if
text
is non-nil
, andtextTranslation
is non-nil
. Otherwise, it is ignored.This attribute corresponds to the
text-translate-anchor
layout property in the Mapbox Style Specification.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<NSValue *> *textTranslationAnchor;
Swift
var textTranslationAnchor: MGLStyleValue