tested on android emulator . need to create new emulator and set API of emulator to Google API (19) and start
var win = Ti.UI.currentWindow;
var annotations=[
// convention centre: 1.311110, 103.778009
// dmit: 1.311671, 103.775800
// hilltop library: 1.311341, 103.774451
{latitude:1.311110,longitude:103.778009, title:"Convention Centre", subtitle:"Big PeRformance here?"},
{latitude:1.311671, longitude:103.775800, title:"DMIT", subtitle:"Digital Media & IT"},
{latitude:1.311341, longitude:103.774451, title:"Hilltop library ", subtitle:"to borrow books"}
];
var annotationObject=[];
Titanium.API.info(annotations.length);
for(var i=0;i{
annotationObject[i]=Titanium.Map.createAnnotation({
latitude:annotations[i].latitude,
longitude:annotations[i].longitude,
title:annotations[i].title,
subtitle:annotations[i].subtitle,
animate:true,
});
}
var mapview = Titanium.Map.createView({
top:50,
mapType: Titanium.Map.STANDARD_TYPE,
region: { latitude:1.311710, longitude:103.775643,
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
annotations:annotationObject
});
win.add(mapview);
//---- another sample
// titanium map view on SP
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
// SP: 1.311710, 103.775643
region: {latitude:1.311710, longitude:103.775643,
// zoom level
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
userLocation:false
});
win.add(mapview);
var win = Ti.UI.currentWindow;
var annotations=[
// convention centre: 1.311110, 103.778009
// dmit: 1.311671, 103.775800
// hilltop library: 1.311341, 103.774451
{latitude:1.311110,longitude:103.778009, title:"Convention Centre", subtitle:"Big PeRformance here?"},
{latitude:1.311671, longitude:103.775800, title:"DMIT", subtitle:"Digital Media & IT"},
{latitude:1.311341, longitude:103.774451, title:"Hilltop library ", subtitle:"to borrow books"}
];
var annotationObject=[];
Titanium.API.info(annotations.length);
for(var i=0;i
annotationObject[i]=Titanium.Map.createAnnotation({
latitude:annotations[i].latitude,
longitude:annotations[i].longitude,
title:annotations[i].title,
subtitle:annotations[i].subtitle,
animate:true,
});
}
var mapview = Titanium.Map.createView({
top:50,
mapType: Titanium.Map.STANDARD_TYPE,
region: {
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
annotations:annotationObject
});
win.add(mapview);
// titanium map view on SP
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
// SP: 1.311710, 103.775643
region: {latitude:1.311710, longitude:103.775643,
// zoom level
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
userLocation:false
});
win.add(mapview);
No comments:
Post a Comment