Time for action – adding a map
This short example will create an app that shows a map.
This example is available for download or browse at https://github.com/myleftboot/Chapter-7-maps. To add a map, perform the following steps:
Create a new blank mobile app by clicking on File | New | Titanium Project. Don't use a template as it will just generate code that gets in the way.
Create the window for the app:
var win1 = Titanium.UI.createWindow({ backgroundColor:'#fff' });
Create a map view. Add the coordinates of the center of the map and the deltas that zoom the maps effectively. The higher the value of the delta, the bigger the area shown:
var theMap = Titanium.Map.createView({ mapType: Ti.Map.SATELLITE_TYPE, region: {latitude: 42.909134, longitude: 0.145054, latitudeDelta: 0.01, longitudeDelta:0.01}, animate:true, regionFit:true, });
Add the map view to the window and open the window:
win1.add(theMap); win1.open...