| Platform | Since |
|---|---|
| Android | 0.8 |
| iPhone | 0.8 |
| iPad | 0.8 |
The top level Map module. The Map module is used for creating in-application native maps.
This is a basic map example that places a custom annotation on the map, and listens for click events on the annotation.
In this example, a custom property (myid) is added to the annotation objct.
While adding custom members to a Titanium object is not generally recommended,
in this case it provides a mechanism for uniquely identifying an annotation. This
can be useful, for example, if the annotations are dynamically generated
and it is not practical to identify them by title.
var mountainView = Titanium.Map.createAnnotation({ latitude:37.390749, longitude:-122.081651, title:"Appcelerator Headquarters", subtitle:'Mountain View, CA', pincolor:Titanium.Map.ANNOTATION_RED, animate:true, leftButton: '../images/appcelerator_small.png', myid:1 // Custom property to uniquely identify this annotation. }); var mapview = Titanium.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, region: {latitude:33.74511, longitude:-84.38993, latitudeDelta:0.01, longitudeDelta:0.01}, animate:true, regionFit:true, userLocation:true, annotations:[mountainView] }); win.add(mapview); // Handle click events on any annotations on this map. mapview.addEventListener('click', function(evt) { Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid); // Check for all of the possible names that clicksouce // can report for the left button/view. if (evt.clicksource == 'leftButton' || evt.clicksource == 'leftPane' || evt.clicksource == 'leftView') { Ti.API.info("Annotation " + evt.title + ", left button clicked."); } });
| Name | Summary |
|---|---|
| Titanium.Map.Annotation |
Represents a labeled point of interest on the map that the user can click on. |
| Titanium.Map.View |
Map view is used for embedding native mapping capabilities as a view in your application. |
| Name | Summary |
|---|---|
| addEventListener |
Adds the specified callback as an event listener for the named event. |
| createAnnotation |
Creates and returns an instance of |
| createView |
Creates and returns an instance of |
| fireEvent |
Fires a synthesized event to any registered listeners. |
| removeEventListener |
Removes the specified callback as an event listener for the named event. |
| Name | Type | Summary |
|---|---|---|
| ANNOTATION_GREEN | Number |
Color constant used to set a map annotation to green via the
|
| ANNOTATION_PURPLE | Number |
Color constant used to set a map annotation to purple via the
|
| ANNOTATION_RED | Number |
Color constant used to set a map annotation to red via the
|
| HYBRID_TYPE | Number |
Used with mapType to display a satellite image of the area with road and road name information layered on top. read-only |
| SATELLITE_TYPE | Number |
Used with mapType to display satellite imagery of the area. read-only |
| STANDARD_TYPE | Number |
Used with mapType to display a street map that shows the position of all roads and some road names. read-only |