TextOverlay
public final class TextOverlay : ImageOverlay
A TextOverlay will overlay a UILabel on top of a Map. An Overlay is always
on top of other elements, it will always be rotated in such a way that it is
facing the MapView camera. The Overlay scales keeping the size consistent
regardless of how far away the MapView Camera is.
Since a UILabel is used, it can be themed anyway a normal UILabel can be.
By default a UILabel does not get drawn with a background. This can make it
difficult to read over a map in some typefaces. It is recommended that you
manually set a background color. The background color will always be used
to fill the backdrop of the TextOverlay.
-
Create a new TextOverlay
Note: If you are using the minimumTouchSize the box will always pad in all directions around the rendered element.
Declaration
Swift
public init<PositionType: Position>(position: PositionType, label: UILabel, size: CGSize? = nil, anchorPoint: AnchorPoint = .center, minimumTouchSize: CGSize? = nil)Parameters
positionThe location in a Map or Venue where this overlay is. This may be a
Vector3or aCoordinatelabelThe
UILabelcontaining the text you wish to render aUILabelis used since it allows the SDK user to define any combination of fonts, colors, sizes the SDK user may decide to use.sizeThe size of the image in unscaled pixels. If a scaling factor is applied, it is applied to this size automatically. If not size is provided, the size will always default to the size of the UILabel provided.
anchorPointWhere in the label’s 2D position space the
positionpassed above will be associated with. The label is always projected onto the screen such that a ray passing from the camera would pass through the anchorPoint & the position.minimumTouchSizecreates a larger invisible anchor that is only used for determine if a user has touched the overlay. The touch target will always be the size of the minimumTouchSize or the image size. Which ever is greater in both axis. The unit is in content scaled pixels. Defaults to (0, 0)
View on GitHub
TextOverlay Class Reference