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

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 1.30 KB  |  hits: 19  |  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. // this sets the background color of the master UIView (when there are no windows/tab groups on it)
  2. Ti.UI.setBackgroundColor('#000');
  3. Ti.UI.iPhone.statusBarStyle = Ti.UI.iPhone.StatusBar.OPAQUE_BLACK;
  4. //Create main app namespace
  5. var demo={};
  6. //Create a few helpers
  7. demo.myHelpers = {
  8.         isAndroid : function(){
  9.                 return (Ti.Platform.name == 'android');
  10.         },
  11.         makeWindow : function(a){
  12.                 a = a || {};
  13.                 var win = Ti.UI.createWindow(a);
  14.                 //Force the orientations
  15.                 win.orientationModes = [
  16.                         Ti.UI.PORTRAIT,
  17.                         Ti.UI.UPSIDE_PORTRAIT
  18.                 ];
  19.                 return win;    
  20.         }      
  21. };
  22.  
  23. //Bring in the child windows
  24. Ti.include('main.js','camera.js');
  25.  
  26. //Create our configs
  27. var winConfig = {
  28.         title:Ti.Locale.getString('sample_win_title'),
  29.         barColor:'#000',
  30.         backgroundColor:'#fff',
  31.         tabBarHidden:true,
  32.         fullscreen:false,
  33.         navBarHidden : (Ti.Platform.name == 'android') 
  34. };
  35.  
  36. //Create the main launch window
  37. demo.mainWindow = demo.launchMainWindow(winConfig);
  38.  
  39. //Check if we didn't return the window correctly
  40. if(demo.mainWindow===null){
  41.         alert('Forgot to return the window...');
  42. }
  43.  
  44.        
  45. //Based on platfomr launch the App in a specific way
  46. if(Ti.Platform.name!=='android'){
  47.         var tabGroup = Ti.UI.createTabGroup();
  48.         var tab1 = Ti.UI.createTab({window:demo.mainWindow});
  49.     tabGroup.addTab(tab1);
  50.         // open tab group
  51.         tabGroup.open();       
  52. }else{
  53.         demo.mainWindow.open();
  54. }