iOS SDK
Tutorials
API Reference
- MGLTileCoordinateSystem
- MGLComputedShapeSource
- MGLSphericalPosition
- MGLUserLocationAnnotationViewStyle
- MGLDistanceFormatter
- MGLStyleLayer
- MGLMapDebugMaskOptions
- MGLSymbolZOrder
- MGLShape
- MGLLineTranslationAnchor
- MGLMultiPoint
- MGLOfflinePack
- Style Primitives
- MGLMultiPolyline
- MGLTextAnchor
- Primitive Shapes
- MGLIconTranslationAnchor
- NSValue(MGLFillStyleLayerAdditions)
- MGLAnnotation
- NSExpression(MGLAdditions)
- MGLTextJustification
- MGLUserLocationAnnotationView
- MGLMultiPolygon
- MGLCircleStyleLayer
- MGLCoordinateSpan
- MGLNetworkConfiguration
- MGLTextWritingMode
- Other Enumerations
- MGLUserLocation
- MGLCalloutView
- MGLAttributedExpression
- MGLImageSource
- MGLOfflinePackProgress
- MGLIconAnchor
- MGLFillStyleLayer
- MGLFillTranslationAnchor
- Appendices
- MGLOfflinePackProgress
- MGLComputedShapeSourceDataSource
- NSValue(MGLLineStyleLayerAdditions)
- MGLStylable
- MGLRasterResamplingMode
- Geometry
- MGLPolygon
- Location Updates
- MGLClockDirectionFormatter
- NSValue(MGLFillExtrusionStyleLayerAdditions)
- MGLCoordinateSpan
- MGLCluster
- MGLErrorCode
- MGLAccountManager
- MGLForegroundStyleLayer
- MGLRasterTileSource
- MGLTextPitchAlignment
- MGLResourceKind
- MGLMapSnapshotterDelegate
- MGLAnnotationImage
- MGLHillshadeStyleLayer
- MGLOrnamentPosition
- MGLAnnotationViewDragState
- MGLDEMEncoding
- MGLSource
- MGLIconPitchAlignment
- MGLCalloutViewDelegate
- MGLVectorStyleLayer
- MGLRasterStyleLayer
- MGLLoggingConfiguration
- MGLLightAnchor
- Other Categories
- MGLTransition
- MGLLocationManager
- MGLLoggingLevel
- MGLTextTranslationAnchor
- MGLCompassButton
- MGLShapeSource
- NSValue(MGLRasterStyleLayerAdditions)
- MGLAnnotationVerticalAlignment
- MGLPolyline
- Maps
- MGLMapCamera
- MGLOfflineStorage
- Other Type Definitions
- MGLSphericalPosition
- MGLShapeCollection
- NSValue(MGLAdditions)
- Style Content
- MGLSymbolPlacement
- MGLTransition
- Other Classes
- MGLPointCollection
- MGLMapViewDelegate
- Style Layers
- MGLMapSnapshotOverlay
- MGLCoordinateQuad
- MGLTextTransform
- MGLOverlay
- MGLUserTrackingMode
- MGLTileSource
- MGLHillshadeIlluminationAnchor
- MGLTextRotationAlignment
- NSValue(MGLHillshadeStyleLayerAdditions)
- MGLOfflinePackState
- Formatters
- MGLLocationManagerDelegate
- MGLAttributionInfoStyle
- MGLBackgroundStyleLayer
- Styling the Map
- MGLCoordinateBounds
- MGLFillExtrusionTranslationAnchor
- Offline Maps
- MGLCoordinateFormatter
- MGLOrnamentVisibility
- MGLStyle
- MGLFeature
- MGLOfflineRegion
- MGLMapView
- MGLShapeOfflineRegion
- Other Structures
- MGLCirclePitchAlignment
- NSValue(MGLCircleStyleLayerAdditions)
- MGLMapSnapshot
- MGLFillExtrusionStyleLayer
- MGLCoordinateQuad
- MGLMapSnapshotOptions
- Other Protocols
- MGLLineCap
- MGLSymbolStyleLayer
- Other Functions
- MGLCircleTranslationAnchor
- MGLLineJoin
- MGLAnnotationView
- MGLCircleScaleAlignment
- MGLPointAnnotation
- MGLMapSnapshotter
- MGLLineStyleLayer
- MGLAttributionInfo
- MGLCompassDirectionFormatter
- MGLCoordinateBounds
- MGLTilePyramidOfflineRegion
- MGLIconRotationAlignment
- MGLIconTextFit
- Other Constants
- NSValue(MGLSymbolStyleLayerAdditions)
- Annotations
- MGLLight
- MGLHeatmapStyleLayer
- MGLOfflineStorageDelegate
- MGLVectorTileSource
- User Interaction
On This Page
MGLAttributedExpression
@interface MGLAttributedExpression : NSObject
An MGLAttributedExpression
object associates text formatting attibutes (such as font size or font names) to an NSExpression
.
Example
let redColor = UIColor.red
let expression = NSExpression(forConstantValue: "Foo")
let attributes: [MGLAttributedExpressionKey: NSExpression] = [.fontNamesAttribute : NSExpression(forConstantValue: ["DIN Offc Pro Italic",
"Arial Unicode MS Regular"]),
.fontScaleAttribute: NSExpression(forConstantValue: 1.2),
.fontColorAttribute: NSExpression(forConstantValue: redColor)]
let attributedExpression = MGLAttributedExpression(expression, attributes:attributes)
expression
The expression content of the receiver as NSExpression
.
Declaration
Objective-C
@property (nonatomic, strong, readwrite) NSExpression *_Nonnull expression;
Swift
var expression: NSExpression { get set }
attributes
The formatting attributes dictionary. Key | Value Type — | — MGLFontNamesAttribute |
An NSExpression evaluating to an NSString array. MGLFontScaleAttribute |
An NSExpression evaluating to an NSNumber value. MGLFontColorAttribute |
An NSExpression evaluating to an UIColor . |
Declaration
Objective-C
@property (nonatomic, strong, readonly)
NSDictionary<MGLAttributedExpressionKey, NSExpression *>
*_Nonnull attributes;
Swift
var attributes: [MGLAttributedExpressionKey : NSExpression] { get }
-initWithExpression:
Returns an MGLAttributedExpression
object initialized with an expression and no attribute information.
Declaration
Objective-C
- (nonnull instancetype)initWithExpression:(nonnull NSExpression *)expression;
Swift
init(expression: NSExpression)
-initWithExpression:attributes:
Returns an MGLAttributedExpression
object initialized with an expression and text format attributes.
Declaration
Objective-C
- (nonnull instancetype)
initWithExpression:(nonnull NSExpression *)expression
attributes:(nonnull NSDictionary<MGLAttributedExpressionKey,
NSExpression *> *)attrs;
Swift
init(expression: NSExpression, attributes attrs: [MGLAttributedExpressionKey : NSExpression] = [:])
+attributedExpression:fontNames:fontScale:
Creates an MGLAttributedExpression
object initialized with an expression and the format attributes for font names and font size.
Declaration
Objective-C
+ (nonnull instancetype)attributedExpression:(nonnull NSExpression *)expression
fontNames:
(nullable NSArray<NSString *> *)fontNames
fontScale:(nullable NSNumber *)fontScale;
Swift
convenience init(_ expression: NSExpression, fontNames: [String]?, fontScale: NSNumber?)
+attributedExpression:attributes:
Creates an MGLAttributedExpression
object initialized with an expression and the format attributes dictionary.
Declaration
Objective-C
+ (nonnull instancetype)
attributedExpression:(nonnull NSExpression *)expression
attributes:(nonnull NSDictionary<MGLAttributedExpressionKey,
NSExpression *> *)attrs;
Swift
convenience init(_ expression: NSExpression, attributes attrs: [MGLAttributedExpressionKey : NSExpression] = [:])