Label
Class for creating labels on the map.
public init(
id: String = UUID().uuidString,
center: CLLocationCoordinate2D,
color: UIColor,
text: String,
fontSize: CGFloat,
anchor: CGPoint = .zero,
backgroundImage: LabelImage? = nil,
haloColor: UIColor? = nil,
haloRadius: CGFloat? = nil,
relativeAnchor: CGPoint = CGPoint(x: 0.5, y: 0.5),
lineHeight: CGFloat? = nil,
letterSpacing: CGFloat? = nil,
offset: CGPoint = .zero
)
Creates new label on map
id
String
Unique object id
center
CLLocationCoordinate2D
Position on map
color
UIColor
Text color
text
String
Label text
fontSize
CGFloat
Label font size
anchor
CGPoint
The position in pixels of the “tip” of the label relative to its center.
backgroundImage
LabelImage?
Image background for the label
haloColor
UIColor?
Color of letters background (when haloRadius is specified).
haloRadius
CGFloat?
Use haloRadius to add background behind each letter.
relativeAnchor
CGPoint
The relative, from 0 to 1 in each dimension, coordinates of the text box “tip”. Relative to its top left corner, for example: [0, 0] value is the top left corner, [0.5, 0.5] — center point, and [1, 1] is the bottom right corner of the box. The label will be placed so that this point is at geographical coordinates respects the absolute offset
.
lineHeight
CGFloat?
For multiline label lineHeight specify how far lines between each other.(percent)
letterSpacing
CGFloat?
Space between each letter.(percent)
offset
CGPoint
The offset distance of text box from its relativeAnchor
. Positive values indicate right and down, while negative values indicate left and up.