Posted By

rottendevice on 01/14/11


Tagged

iphone


Versions (?)

App.js


 / Published in: JavaScript
 

  1. // this sets the background color of the master UIView (when there are no windows/tab groups on it)
  2. Titanium.UI.setBackgroundColor('#000');
  3. Titanium.UI.iPhone.StatusBar.TRANSLUCENT_BLACK;
  4.  
  5. // create tab group
  6. var tabGroup = Titanium.UI.createTabGroup();
  7.  
  8. //
  9. // create base UI tab and root window
  10. //
  11. var b1 = Titanium.UI.createButton({
  12. title: 'Edit'
  13. });
  14.  
  15. var b2 = Titanium.UI.createButton({
  16. systemButton:Titanium.UI.iPhone.SystemButton.ADD
  17. })
  18.  
  19. b2.addEventListener('click', function()
  20. {
  21. var w = Titanium.UI.createWindow({
  22. //backgroundColor:'#336699',
  23. title:'Modal Window',
  24. //barColor:'black',
  25. url:'/timer/newtimer.js'
  26. });
  27. var saveBtn = Titanium.UI.createButton({
  28. title:'Save',
  29. style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN
  30. });
  31. w.setLeftNavButton(saveBtn);
  32. saveBtn.addEventListener('click',function()
  33. {
  34. w.close();
  35. });
  36. w.open({modal:true});
  37. })
  38.  
  39. var win1 = Titanium.UI.createWindow({
  40. //id: 'win1',
  41. backgroundColor:'#d2d2d2',
  42. title:'Timers',
  43. leftNavButton:b1,
  44. rightNavButton:b2
  45. });
  46. var tab1 = Titanium.UI.createTab({
  47. icon:'KS_nav_views.png',
  48. title:'Timers',
  49. window:win1
  50. });
  51.  
  52. var data = [{title:"Row 1"},{title:"Row 2"}];
  53. var table = Titanium.UI.createTableView({data:data});
  54. win1.add(table);
  55. //
  56. // create controls tab and root window
  57. //
  58. var win2 = Titanium.UI.createWindow({
  59. title:'Settings',
  60. backgroundColor:'#fff'
  61. });
  62. var tab2 = Titanium.UI.createTab({
  63. icon:'KS_nav_ui.png',
  64. title:'Settings',
  65. window:win2
  66. });
  67.  
  68. var label2 = Titanium.UI.createLabel({
  69. color:'#999',
  70. text:'I am your dead dog, haunting you for not feeding me.',
  71. font:{fontSize:20,fontFamily:'Helvetica Neue'},
  72. textAlign:'center',
  73. width:'auto'
  74. });
  75.  
  76. win2.add(label2);
  77.  
  78.  
  79. //
  80. // add tabs
  81. //
  82. tabGroup.addTab(tab1);
  83. tabGroup.addTab(tab2);
  84.  
  85.  
  86. // open tab group
  87. tabGroup.open();

Report this snippet  

You need to login to post a comment.