Drop multiple pins (locations) from database
I have an idea for an app, and part of it will be storing a location (lat,long) in a local db. I plan on having a button that the user can click that will basically loop through and drop the pins on the Mapview.
I looked at the KitchenSink, and am wondering if basically I'll select from my db, and have a do..while of this code, subbing X for the iteration, and the appropriate lat/long/etc.
var apple[x] = Titanium.Map.createAnnotation({
latitude:37.33168900,
longitude:-122.03073100,
title:"Steve Jobs",
subtitle:'Cupertino, CA',
pincolor:Titanium.Map.ANNOTATION_GREEN,
animate:true,
rightButton: '../images/apple_logo.jpg',
myid:[x] // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
});
Then paste and modify this code to drop the pins
// CREATE MAP VIEW
//
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
region:{latitude:33.74511, longitude:-84.38993, latitudeDelta:0.5, longitudeDelta:0.5},
animate:true,
regionFit:true,
userLocation:true,
annotations:[apple[x]]
});
if (!isAndroid) {
mapview.addAnnotation(atlanta);
}
mapview.selectAnnotation(atlanta);
win.add(mapview);
I'm wondering if there is a better way to store and pull this though before I add it to the map, especially the "annotations:[apple[x]]"…