Guest User

Untitled

a guest
Jun 21st, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. // this sets the background color of the master UIView (when there are no windows/tab groups on it)
  2. Titanium.UI.setBackgroundColor('#f00');
  3.  
  4. //create tab group
  5. var tabGroup = Titanium.UI.createTabGroup();
  6.  
  7. //
  8. // create base UI tab and root window
  9. //
  10. var win1 = Titanium.UI.createWindow({
  11. title:'Tab 1',
  12. backgroundColor:'#fff'
  13. });
  14.  
  15. var tab1 = Titanium.UI.createTab({
  16. icon:'KS_nav_views.png',
  17. title:'Tab 1',
  18. window:win1
  19. });
  20.  
  21. var label1 = Titanium.UI.createLabel({
  22. color:'#999',
  23. text:'I am Window 1',
  24. font:{fontSize:20,fontFamily:'Helvetica Neue'},
  25. textAlign:'center',
  26. width:'auto'
  27. });
  28. win1.add(label1);
  29.  
  30. //
  31. // create controls tab and root window
  32. //
  33. var win2 = Titanium.UI.createWindow({
  34. title:'Tab 2',
  35. backgroundColor:'#fff'
  36. });
  37. var tab2 = Titanium.UI.createTab({
  38. icon:'KS_nav_ui.png',
  39. title:'Tab 2',
  40. window:win2
  41. });
  42.  
  43. var label2 = Titanium.UI.createLabel({
  44. color:'#999',
  45. text:'I am Window 2',
  46. font:{fontSize:20,fontFamily:'Helvetica Neue'},
  47. textAlign:'center',
  48. width:'auto'
  49. });
  50. win2.add(label2);
  51.  
  52. //
  53. // add tabs
  54. //
  55. tabGroup.addTab(tab1);
  56. tabGroup.addTab(tab2);
  57.  
  58. // open tab group
  59. tabGroup.open();
  60.  
  61.  
  62. var button = Ti.UI.createButton({
  63. title:'Close',
  64. top:100,
  65. height:30,
  66. width:60
  67. });
  68. win1.add(button);
  69.  
  70. var win3 = Ti.UI.createWindow({
  71. title:'Window 3',
  72. backgroundColor:'#0f0'
  73. });
  74.  
  75. var label3 = Ti.UI.createLabel({
  76. color:'#999',
  77. text:'I am Window 3 (not tab)',
  78. font:{fontSize:20,fontFamily:'Helvetica Neue'},
  79. textAlign:'center',
  80. width:'auto'
  81. });
  82. win3.add(label3);
  83.  
  84. button.addEventListener('click', function(){
  85. // win3.open();
  86. tabGroup.close();
  87. // tabGroup.open();
  88. });
Add Comment
Please, Sign In to add comment