Forked from bob-sims/Appcelerator MapView annotation properties
Created
February 19, 2013 18:05
-
-
Save cstrap/4988308 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentWin = Ti.UI.currentWindow; | |
// below example would require variable declarations for Name, Description, image, Lat, Longitude | |
// Docs: | |
// http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Map.Annotation-object | |
// http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Map.MapView-object | |
// | |
// CREATE MAP VIEW | |
// | |
var mapview = Titanium.Map.createView({ | |
mapType: Titanium.Map.STANDARD_TYPE, | |
region:{latitude:Lat, longitude:Longitude, latitudeDelta:0.008, longitudeDelta:0.008}, | |
animate:true, | |
regionFit:true, | |
userLocation:true, | |
}); | |
// create an annotation | |
// note: appears to be no way to fire event from marker pin, only the annotation (caption)? | |
// note: is there any way to style (color, text alignment, transparency?) the annotation (caption) in Android? | |
var marker = Titanium.Map.createAnnotation({ | |
animate:true, | |
title:Name, //works in Android | |
subtitle:Description, //works in Android | |
leftView:image, // doesn't work in Android, either passing view object or image? | |
rightButton:'../icons/marker.png', //doesn't work in Android, either image or button object? | |
latitude:parseFloat(Lat), //works | |
longitude:parseFloat(Longitude), //works | |
image:'../icons/marker.png', //*does* work in Android! Creates drop-shadow automagically | |
myid:3 | |
}); | |
mapview.addAnnotation(marker); | |
currentWin.add(mapview); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment