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] = [:])
iOS SDK
Tutorials
API Reference
- MGLUserLocationAnnotationViewStyle
- MGLAccountManager
- MGLAnnotationImage
- MGLCircleStyleLayer
- MGLMapSnapshot
- NSValue(MGLHillshadeStyleLayerAdditions)
- MGLLight
- MGLCoordinateSpan
- MGLOfflinePack
- MGLAnnotationVerticalAlignment
- MGLSource
- MGLDEMEncoding
- MGLCoordinateSpan
- MGLMapCamera
- MGLTextWritingMode
- MGLIconTranslationAnchor
- NSValue(MGLSymbolStyleLayerAdditions)
- MGLOfflinePackProgress
- MGLMapSnapshotOptions
- Primitive Shapes
- NSValue(MGLAdditions)
- MGLTextPitchAlignment
- MGLSphericalPosition
- MGLCompassDirectionFormatter
- MGLVectorTileSource
- MGLMapViewDelegate
- MGLHillshadeIlluminationAnchor
- MGLIconTextFit
- MGLLocationManagerDelegate
- MGLShape
- Formatters
- MGLCoordinateBounds
- MGLCoordinateQuad
- MGLMapSnapshotterDelegate
- MGLAnnotationViewDragState
- MGLComputedShapeSource
- NSValue(MGLCircleStyleLayerAdditions)
- MGLHillshadeStyleLayer
- MGLOverlay
- MGLPolygon
- MGLStyleLayer
- MGLTilePyramidOfflineRegion
- MGLMapView
- MGLTransition
- MGLOfflineStorage
- MGLComputedShapeSourceDataSource
- MGLMapDebugMaskOptions
- MGLClockDirectionFormatter
- MGLTextRotationAlignment
- MGLUserTrackingMode
- NSValue(MGLRasterStyleLayerAdditions)
- MGLAttributionInfo
- MGLRasterStyleLayer
- Style Content
- MGLUserLocation
- MGLRasterTileSource
- MGLFillTranslationAnchor
- Other Protocols
- MGLSphericalPosition
- MGLMapSnapshotter
- MGLRasterResamplingMode
- MGLAnnotationView
- MGLResourceKind
- MGLShapeCollection
- Other Enumerations
- NSExpression(MGLAdditions)
- MGLCirclePitchAlignment
- MGLFillExtrusionTranslationAnchor
- Style Layers
- Other Constants
- MGLCoordinateBounds
- Appendices
- MGLLoggingConfiguration
- Other Structures
- MGLMapSnapshotOverlay
- MGLCircleTranslationAnchor
- User Interaction
- NSValue(MGLLineStyleLayerAdditions)
- MGLErrorCode
- MGLAttributedExpression
- MGLSymbolStyleLayer
- MGLCircleScaleAlignment
- MGLTextTransform
- MGLOrnamentVisibility
- MGLMultiPoint
- MGLShapeSource
- MGLLightAnchor
- MGLCalloutViewDelegate
- MGLCluster
- MGLOfflinePackProgress
- MGLPolyline
- MGLFeature
- MGLAnnotation
- MGLFillStyleLayer
- MGLIconRotationAlignment
- NSValue(MGLFillStyleLayerAdditions)
- Other Classes
- MGLLineTranslationAnchor
- MGLTextAnchor
- Offline Maps
- MGLLocationManager
- MGLStyle
- Other Type Definitions
- NSValue(MGLFillExtrusionStyleLayerAdditions)
- Style Primitives
- MGLTileSource
- MGLTransition
- MGLForegroundStyleLayer
- MGLStylable
- MGLIconPitchAlignment
- MGLOfflineRegion
- MGLHeatmapStyleLayer
- MGLCompassButton
- MGLFillExtrusionStyleLayer
- MGLSymbolPlacement
- MGLMultiPolyline
- MGLOfflinePackState
- MGLImageSource
- MGLCoordinateFormatter
- MGLDistanceFormatter
- MGLCoordinateQuad
- MGLPointCollection
- MGLPointAnnotation
- MGLTextJustification
- MGLOfflineStorageDelegate
- MGLCalloutView
- MGLOrnamentPosition
- MGLUserLocationAnnotationView
- MGLTileCoordinateSystem
- MGLSymbolZOrder
- MGLLineCap
- Other Functions
- MGLNetworkConfiguration
- MGLShapeOfflineRegion
- Styling the Map
- MGLLineJoin
- Maps
- MGLAttributionInfoStyle
- MGLIconAnchor
- MGLBackgroundStyleLayer
- MGLMultiPolygon
- Annotations
- MGLVectorStyleLayer
- Location Updates
- MGLTextTranslationAnchor
- MGLLineStyleLayer
- Other Categories
- Geometry
- MGLLoggingLevel