Guest User

Untitled

a guest
Jan 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 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('#000');
  3.  
  4. // create tab group
  5. var tabGroup = Titanium.UI.createTabGroup();
  6.  
  7.  
  8. //
  9. // create base UI tab and root window
  10. //
  11. var win1 = Titanium.UI.createWindow({
  12. title:'Tab 1',
  13. backgroundColor:'#fff'
  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.  
  29. win1.add(label1);
  30.  
  31. //
  32. // create controls tab and root window
  33. //
  34. var win2 = Titanium.UI.createWindow({
  35. title:'Tab 2',
  36. backgroundColor:'#fff'
  37. });
  38. var tab2 = Titanium.UI.createTab({
  39. icon:'KS_nav_ui.png',
  40. title:'Tab 2',
  41. window:win2
  42. });
  43.  
  44. var label2 = Titanium.UI.createLabel({
  45. color:'#999',
  46. text:'I am Window 2',
  47. font:{fontSize:20,fontFamily:'Helvetica Neue'},
  48. textAlign:'center',
  49. width:'auto'
  50. });
  51.  
  52. win2.add(label2);
  53.  
  54. Ti.Accelerometer.addEventListener('update', function(source, timestamp, type, x, y, z) {
  55. debugLabel.text = '' + x, ' y:' + y + 'z:' + z;
  56. });
  57.  
  58. var debugLabel = Ti.UI.createLabel({
  59. text: 'här kommer debug-text',
  60. top: 0,
  61. left: 0
  62. });
  63.  
  64. win1.add(debugLabel);
  65.  
  66. //
  67. // add tabs
  68. //
  69. tabGroup.addTab(tab1);
  70. tabGroup.addTab(tab2);
  71.  
  72.  
  73. // open tab group
  74. tabGroup.open();
Add Comment
Please, Sign In to add comment