Represents a labeled point of interest on the map that the user can click on.
The Annotation
object gives you low-level control over annotations that can be added to
map view. An annotation must have its latitude
and longitude
properties set to appear on a map.
Use the Modules.Map.createAnnotation method to create an annotation. Starting with Alloy
1.4.0, use the <Annotation>
Alloy element to define one in XML markup.
An annotation can also have a title, a subtitle, and two inset buttons or views on the left and right side of the title. All of these items are optional.
The controls on the left and right side of the annotation can be specified in one of two ways:
To display an image, set the leftButton or rightButton property to an image URL. (On iOS, you can also use a SystemButton constant to use one of the native system button icons.)
To add another type of view to the annotation, set the leftView or rightView property to a View object.
An annotation has two states: selected and deselected. A deselected annotation is marked by a pin image. When the user selects the pin, the full annotation is displayed.
You can specify a custom image for the map pin by setting the image property.
When the user clicks on an annotation, a click
event is generated.
On iOS, You can add a click event listener to a specific annotation, or add a click event listener to the map view to receive click events from all annotations on the map.
On Android, you must add the click event listener to the map view; the annotation itself does not generate these events.
The display priority of this annotation view.
Requires: iOS 11.0 and later
An annotation view whose priority is set to MKFeatureDisplayPriorityRequired is always visible on the map, whereas other priorities may result in the annotation view being hidden. Use Modules.Map.FEATURE_DISPLAY_PRIORITY_REQUIRED, Modules.Map.FEATURE_DISPLAY_PRIORITY_DEFAULT_HIGH or Modules.Map.FEATURE_DISPLAY_PRIORITY_DEFAULT_LOW.
This API can be assigned the following constants:
Default: Modules.Map.FEATURE_DISPLAY_PRIORITY_REQUIRE
The name of the API that this proxy corresponds to.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Default: true
Defines whether the annotation view is able to display extra information in a callout bubble.
Defines whether the annotation view is able to display extra information in a callout bubble.
When this is set to true
, the annotation view shows the callout bubble on selection.
Set this to false
to disabled the showing of the callout bubble on selection.
This must be set before the annotation is added to the map.
If this value is undefined, the value is treated as explicit true.
Defines a center offset point for the annotation.
Defines a center offset point for the annotation.
By default, the center point of an annotation view is placed at the coordinate point of the associated annotation. Use this property to reposition the annotation view as needed. Positive offset values move the annotation view down and right, while negative values move it up and left.
An identifier that determines whether the annotation view participates in clustering.
Requires: iOS 11.0 and later
The default value of this property is null, which prevents the annotation view from being clustered with other annotation views. Setting the property to a non null value it to participate in clustering. Clustering occurs when there is a collision between multiple annotation views with the same identifier on the map surface. The annotation views involved in the collision are removed from the map view and replaced by a clustering annotation view, which displays the title from one of the annotations and provides access to the other annotations.
Default:
The collision mode to use when interpreting the collision frame rectangle.
Requires: iOS 11.0 and later
Use Modules.Map.ANNOTATION_VIEW_COLLISION_MODE_RECTANGLE or Modules.Map.ANNOTATION_VIEW_COLLISION_MODE_CIRCLE.
This API can be assigned the following constants:
Defines a custom view to be used by the annotation.
Defines a custom view to be used by the annotation.
Must be set during creation. User interaction is disabled on the view. No view interaction events (click, touchstart etc) will be fired.
Determines whether the pin can be dragged by the user.
When an annotation is draggable, it can be moved by the user by long pressing on the pin.
Default: false
Image to use for the the pin.
Must be set during creation. This is ignored if the customView property is set.
Default: If not specified, a standard map pin image is used.
Latitude of the annotation, in decimal degrees.
Latitude of the annotation, in decimal degrees.
Left button image on the annotation, specified as an image URL.
Left button image on the annotation, specified as an image URL.
Left view that is displayed on the annotation.
Left view that is displayed on the annotation.
This is ignored if the leftButton
property is set.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.
Longitude of the annotation, in decimal degrees.
Longitude of the annotation, in decimal degrees.
Boolean indicating whether the marker animates into position onscreen.
Requires: iOS 11.0 and later
Default: false
The background color of the marker balloon.
Requires: iOS 11.0 and later
The default value of this property is undefined, which applies the standard color that is appropriate for the current map style.
The color to apply to the glyph text or image.
Requires: iOS 11.0 and later
The default value of this property is undefined, which applies the standard tint color for the current map style.
The image displayed in the marker balloon.
Requires: iOS 11.0 and later
Use this property or the markerGlyphText property to specify the marker balloon content. If you specify both an image and text, the text is displayed. The glyph image is displayed when the marker is in the normal state. Create glyph images as template images so that the glyph tint color can be applied to it. Normally, you set the size of this image to 20 by 20 points on iOS. However, if you do not provide a separate selected image in the markerSelectedGlyphImage property, make the size of this image 40 by 40 points on iOS. MapKit scales images that are larger or smaller than those sizes.
The text to display in the marker balloon.
Requires: iOS 11.0 and later
Use this property or the markerGlyphImage property to specify the marker balloon content. If you specify both an image and text, the text is displayed. The amount of space available for displaying your glyph text is limited. Specify no more than two or three characters for any strings you assign to this property.
The image to display when the marker is selected.
Requires: iOS 11.0 and later
The glyph image is displayed when the marker is in the selected state. This image is displayed only when the marker is selected. If you specify an image for this property, you should also specify an image in the markerGlyphImage property. Create glyph images as template images so that the glyph tint color can be applied to it. Set the size of this image to 40 by 40 points on iOS. MapKit scales images that are larger or smaller than those sizes.
The visibility of the subtitle text rendered below the marker balloon.
Requires: iOS 11.0 and later
The subtitle text is hidden when the marker is not selected. The text is shown when the marker is selected. Use Modules.Map.FEATURE_VISIBILITY_ADAPTIVE, Modules.Map.FEATURE_VISIBILITY_VISIBLE or Modules.Map.FEATURE_VISIBILITY_HIDDEN.
This API can be assigned the following constants:
The visibility of the title text rendered below the marker balloon.
Requires: iOS 11.0 and later
Title text is normally displayed below the marker balloon. Use Modules.Map.FEATURE_VISIBILITY_ADAPTIVE, Modules.Map.FEATURE_VISIBILITY_VISIBLE or Modules.Map.FEATURE_VISIBILITY_HIDDEN.
This API can be assigned the following constants:
The color of the pin-annotation. Use the ANNOTATION_*
constants for pre-
defined colors, e.g ANNOTATION_GREEN
.
Note for iOS: Apps running iOS 9 and later can also specify a non-constant value, e.g. "blue", "rgb(0, 0, 255 ,1)" or "#0000ff".
Pin color is ignored if a custom pin image is specified using image.
The preview context used in the 3D-Touch feature "Peek and Pop".
Requires: iOS 9.0 and later
Preview context to present the "Peek and Pop" of a view. Use an configured instance of Titanium.UI.iOS.PreviewContext here.
Note: This property can only be used on devices running iOS9 or later and supporting 3D-Touch. It is ignored on older devices and can manually be checked using Titanium.UI.iOS.forceTouchSupported.
Right button image on the annotation, specified as an image URL.
Right button image on the annotation, specified as an image URL.
Right view that is displayed on the annotation.
Right view that is displayed on the annotation.
This is ignored if the rightButton
property is set.
Boolean to show an annotation view that displays a balloon-shaped marker at the designated location.
Requires: iOS 11.0 and later
Must be set during creation. This is ignored if the customView property is set. See the example "Map Example With Marker Annotation and Clustering".
Default: false
Show or hide the view that is displayed on the annotation when clicked.
When this is false, clicking on the annotation will not center it on the map, but the annotation will still be selected, thus triggering the click event. If the annotation is selected, and the info window is hidden, then the next click will deselect the annotation, thus will NOT show the info window, regardless of the current state of this property.
Default: true
Key in the locale file to use for the subtitle property.
Key in the locale file to use for the subtitle property.
Key in the locale file to use for the title property.
Key in the locale file to use for the title property.
Adds the specified callback as an event listener for the named event.
Name of the event.
Callback function to invoke when the event is fired.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
A dictionary of properties to apply.
Fires a synthesized event to any registered listeners.
Name of the event.
A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback
parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Name of the event.
Callback function to remove. Must be the same function passed to addEventListener
.
Sets the value of the annotationDisplayPriority property.
New value for the property.
Sets the value of the bubbleParent property.
New value for the property.
Sets the value of the canShowCallout property.
New value for the property.
Sets the value of the centerOffset property.
New value for the property.
Sets the value of the clusterIdentifier property.
New value for the property.
Sets the value of the collisionMode property.
New value for the property.
Sets the value of the customView property.
New value for the property.
Sets the value of the draggable property.
New value for the property.
Sets the value of the hidden property.
New value for the property.
Sets the value of the image property.
New value for the property.
Sets the value of the latitude property.
New value for the property.
Sets the value of the leftButton property.
New value for the property.
Sets the value of the leftView property.
New value for the property.
Sets the value of the lifecycleContainer property.
New value for the property.
Sets the value of the longitude property.
New value for the property.
Sets the value of the markerAnimatesWhenAdded property.
New value for the property.
Sets the value of the markerColor property.
New value for the property.
Sets the value of the markerGlyphColor property.
New value for the property.
Sets the value of the markerGlyphImage property.
New value for the property.
Sets the value of the markerGlyphText property.
New value for the property.
Sets the value of the markerSelectedGlyphImage property.
New value for the property.
Sets the value of the markerSubtitleVisibility property.
New value for the property.
Sets the value of the markerTitleVisibility property.
New value for the property.
Sets the value of the pincolor property.
New value for the property.
Sets the value of the previewContext property.
New value for the property.
Sets the value of the rightButton property.
New value for the property.
Sets the value of the rightView property.
New value for the property.
Sets the value of the showAsMarker property.
New value for the property.
Sets the value of the showInfoWindow property.
New value for the property.
Sets the value of the subtitle property.
New value for the property.
Sets the value of the subtitleid property.
New value for the property.
Sets the value of the title property.
New value for the property.
Sets the value of the titleid property.
New value for the property.