ViewAnnotationManager
Manager API to control View Annotations.
View annotations are UIView
instances that are drawn on top of the MapView
and bound to some Geometry
(only Point
is supported for now).
In case some view annotations intersect on the screen Z-index is based on addition order.
View annotations are invariant to map camera transformations however such properties as size, visibility etc could be controlled by the user using update operation.
View annotations are not explicitly bound to any sources however associatedFeatureId
could be
used to bind given view annotation with some Feature
by Feature.identifier
meaning visibility of view annotation will be driven
by visibility of given feature.
-
If the superview or the
UIView.isHidden
property of a custom view annotation is changed manually by the users the SDK prints a warning and reverts the changes, as the view is still considered for layout calculation. The default value is true, and setting this value to false will disable the validation. -
The complete list of annotations associated with the receiver.
-
Add a
UIView
instance which will be displayed as an annotation. View dimensions will be taken as width / height from the bounds of the view unless they are not specified explicitly withwidth
andheight
.Annotation
options
must include Geometry where we want to bind our view annotation.Width and height could be specified explicitly but better idea will be not specifying them as they will be calculated automatically based on view layout.
Important
The annotation view to be added should have
UIView.transform
property set to.identity
. Providing a transformed view can result in annotation views being misplaced, overlapped and other layout artifacts.Note
Use
update(_:options:)
for changing the visibilty of the view, instead ofUIView.isHidden
so that it is removed from the layout calculation.Throws
Throws:
viewIsAlreadyAdded
if the supplied view is already added as an annotationgeometryFieldMissing
if options did not include geometryassociatedFeatureIdIsAlreadyInUse
if the suppliedassociatedFeatureId
is already used by another annotation viewMapError
: errors during insertion
-
Add a
UIView
instance which will be displayed as an annotation. View dimensions will be taken as width / height from the bounds of the view unless they are not specified explicitly withwidth
andheight
.Annotation
options
must include Geometry where we want to bind our view annotation.Width and height could be specified explicitly but better idea will be not specifying them as they will be calculated automatically based on view layout.
Important
The annotation view to be added should have
UIView.transform
property set to.identity
. Providing a transformed view can result in annotation views being misplaced, overlapped and other layout artifacts.Note
Use
update(_:options:)
for changing the visibilty of the view, instead ofUIView.isHidden
so that it is removed from the layout calculation.Throws
Throws:
viewIsAlreadyAdded
if the supplied view is already added as an annotation, or there is an existing annotation view with the sameid
.geometryFieldMissing
if options did not include geometryassociatedFeatureIdIsAlreadyInUse
if the suppliedassociatedFeatureId
is already used by another annotation viewMapError
: errors during insertion
-
Remove given
UIView
from the map if it was present. -
Removes all annotations views from the map.
-
Update given
UIView
withViewAnnotationOptions
. Important thing to keep in mind that only properties present inoptions
will be updated, all other will remain the same as specified before.Important
The annotation view to be updated should have
UIView.frame
property set toidentify
. Providing a transformed view can result in annotation views being misplaced, overlapped and other layout artifacts.Throws
annotationNotFound
: the supplied view was not foundassociatedFeatureIdIsAlreadyInUse
if the suppliedassociatedFeatureId
is already used by another annotation viewMapError
: errors during the update of the view (eg. incorrect parameters)
-
Find view annotation by the given
id
. -
Find
UIView
by feature id if it was specified as part ofassociatedFeatureId
. -
Find
ViewAnnotationOptions
of view annotation by feature id if it was specified as part ofassociatedFeatureId
. -
Get current
ViewAnnotationOptions
for givenUIView
. -
Add an observer for annotation views updates
Observers are held strongly.
-
Remove an observer for annotation views updates.
-
Calculates
CameraOptions
to fit the list of view annotations.Important
This API isn’t supported by Globe projection.