Represents a labeled point of interest on the map that the user can click on.
deprecated
3.2.0 For new Android applications or to use Google Maps v2, use the ti.map add-on module.
For the iOS platform, use the ti.map add-on module. Support for the
Titanium.Map
module on iOS was removed in Release 3.2.0.
For all other platforms, continue to use this module.
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.
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.
leftButton
and leftView
are mutually exclusive, as are rightButton
and
rightView
.
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.
Use the Titanium.Map.createAnnotation method to create an annotation.
Boolean to indicate whether the pin should animate when dropped.
Boolean to indicate whether the pin should animate when dropped.
Must be set before the annotation is added to the map view.
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 to the right, while negative values move it up and to the left.
Defines a custom view to be used by the annotation.
Defines a custom view to be used by the annotation.
A custom View to display for the annotation. 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.
Must be set before the annotation is added to the map view.
Default: false
Image to use for the the pin.
The image can be specified using a local URL or an image Blob
. 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 or an iOS button constant.
Left button image on the annotation, specified as an image URL or an iOS button constant.
On iOS, you can specify a system button icon using one of the SystemButton constants:
myAnnotation.leftButton = Titanium.UI.iPhone.SystemButton.INFO_LIGHT;
Mutually exclusive with leftView
.
Left view that is displayed on the annotation.
Left view that is displayed on the annotation.
Mutually exclusive with leftButton
.
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.
Image for the pin instead of the default image.
deprecated since 1.4
Use <Titanium.Map.Annotation.image> instead.
Pin color. Specify one of: Titanium.Map.ANNOTATION_GREEN, Titanium.Map.ANNOTATION_PURPLE or Titanium.Map.ANNOTATION_RED.
Pin color is ignored if a custom pin image is specified using image.
Right button image on the annotation, specified as an image URL or an iOS button constant.
Right button image on the annotation, specified as an image URL or an iOS button constant.
On iOS, you can specify a system button icon using one of the SystemButton constants.
Mutually exclusive with rightView
.
Right view that is displayed on the annotation.
Right view that is displayed on the annotation.
Mutually exclusive with rightButton
.
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.
Gets the value of the pinImage property.
deprecated since 1.4
Use <Titanium.Map.Annotation.image> instead.
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 animate 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 customView property.
New value for the property.
Sets the value of the draggable 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 pinImage property.
deprecated since 1.4
Use <Titanium.Map.Annotation.image> instead.
New value for the property.
Sets the value of the pincolor 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 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.
Fired when the user selects, deselects, or clicks on this annotation.
This event is not currently supported on Android. Register for the click event on the map view to receive events when any of the map's annotations are clicked.
This event is fired in two circumstances:
On iOS, the user deselects an annotation by clicking in the map view outside of the annotation. On Android, the user deselects an annotation by clicking on the annotation pin.
The click
event includes a value, clicksource
, which describes the part of the
annotation that was clicked. Note that the possible values for clicksource
differ between
platforms.
On iOS, if the user clicks on the pin or annotation, the clicksource
is one of:
pin
, annotation
, leftButton
, rightButton
, leftView
, rightView
,
title
, or subtitle
. If the user deselects the annotation by clicking elsewhere
in the map view, clicksource
is null
.
Index of the annotation in the map view's annotations array.
Title of the annotation.
The map view instance that this annotation belongs to.
Source of the click event, such as pin
, or leftButton
.
Annotation source object.
Source object that fired the event.
Name of the event fired.
True if the event will try to bubble up if possible.
Set to true to stop the event from bubbling.