
Untitled
By: a guest on
Aug 3rd, 2012 | syntax:
None | size: 1.50 KB | hits: 9 | expires: Never
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
// title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
label1.addEventListener('click', function(e) {
Titanium.Geolocation.purpose = "Testing geolocation";
Titanium.Geolocation.forwardGeocoder("111 8th ave nyc", function(e) {
if (e.error) {
alert(e.error);
}
var mapAnnos = Titanium.Map.createAnnotation({
animate: true,
pincolor: Titanium.Map.ANNOTATION_PURPLE,
title: "Office",
latitude:e.latitude,
longitude:e.longitude,
});
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
region: {latitude: e.latitude, longitude: e.longitude, latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
userLocation:true,
annotations: [mapAnnos]
});
win1.add(mapview);
});
});
win1.add(label1);
tabGroup.addTab(tab1);
//tabGroup.addTab(tab2);
// open tab group
tabGroup.open();