Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 1.50 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. // this sets the background color of the master UIView (when there are no windows/tab groups on it)
  3. Titanium.UI.setBackgroundColor('#000');
  4.  
  5. // create tab group
  6. var tabGroup = Titanium.UI.createTabGroup();
  7.  
  8.  
  9. //
  10. // create base UI tab and root window
  11. //
  12. var win1 = Titanium.UI.createWindow({  
  13.    // title:'Tab 1',
  14.     backgroundColor:'#fff'
  15. });
  16. var tab1 = Titanium.UI.createTab({  
  17.     icon:'KS_nav_views.png',
  18.     title:'Tab 1',
  19.     window:win1
  20. });
  21.  
  22. var label1 = Titanium.UI.createLabel({
  23.         color:'#999',
  24.         text:'I am Window 1',
  25.         font:{fontSize:20,fontFamily:'Helvetica Neue'},
  26.         textAlign:'center',
  27.         width:'auto'
  28. });
  29. label1.addEventListener('click', function(e) {
  30.         Titanium.Geolocation.purpose = "Testing geolocation";
  31.         Titanium.Geolocation.forwardGeocoder("111 8th ave nyc", function(e) {
  32.                 if (e.error) {
  33.                         alert(e.error);
  34.                 }
  35.                 var mapAnnos = Titanium.Map.createAnnotation({
  36.                         animate: true,
  37.                         pincolor: Titanium.Map.ANNOTATION_PURPLE,
  38.                         title: "Office",
  39.                         latitude:e.latitude,
  40.                 longitude:e.longitude,
  41.                 });
  42.                 var mapview = Titanium.Map.createView({
  43.                 mapType: Titanium.Map.STANDARD_TYPE,
  44.                 region: {latitude: e.latitude, longitude: e.longitude, latitudeDelta:0.01, longitudeDelta:0.01},
  45.                 animate:true,
  46.                 regionFit:true,
  47.                 userLocation:true,
  48.                 annotations: [mapAnnos]
  49.             });
  50.                
  51.             win1.add(mapview);
  52.         });
  53. });
  54.  
  55. win1.add(label1);
  56.        
  57. tabGroup.addTab(tab1);  
  58. //tabGroup.addTab(tab2);  
  59.  
  60.  
  61. // open tab group
  62. tabGroup.open();