2013-04-27 66 views
0

我開始使用基本選項卡式模型,並使用KitchenSink開始更改「自定義」它以滿足我的需要。我創建了3個桌面視圖,每個視圖打開它自己的垂直佈局和桌面視圖。出於某種原因,我沒有讀過的東西。我無法附加任何東西到第一個標籤。幫助將不勝感激。在Titanium中爲Android創建選項卡式應用程序

我也包括JS文件的一部分

app.js

(function() { 
//determine platform and form factor and render approproate components 
var osname = Ti.Platform.osname, 
    version = Ti.Platform.version, 
    height = Ti.Platform.displayCaps.platformHeight, 
    width = Ti.Platform.displayCaps.platformWidth; 

//considering tablet to have one dimension over 900px - this is imperfect, so you should feel free to decide 
//yourself what you consider a tablet form factor for android 
var isTablet = osname === 'ipad' || (osname === 'android' && (width > 899 || height > 899)); 

var Window; 
if (isTablet) { 
    Window = require('ui/tablet/ApplicationWindow'); 
} 
else { 
    Window = require('ui/handheld/ApplicationWindow'); 
} 

var ApplicationTabGroup = require('ui/common/ApplicationTabGroup'); 
new ApplicationTabGroup(Window).open(); 

})();

applicationTabGroup。

function ApplicationTabGroup(Window) { 
//create module instance 
var self = Ti.UI.createTabGroup(); 

//create app tabs 
var win1 = new Window(('Core Measures')), 
    win2 = new Window(('Patient')); 
    win3 = new Window(('Provider')); 

var tab1 = Ti.UI.createTab({ 
    title: ('Core Measures'), 
    window: win1 
}); 
win1.containingTab = tab1; 

var tab2 = Ti.UI.createTab({ 
    title: ('Patient'), 
    window: win2 
}); 
win2.containingTab = tab2; 

var tab3 = Ti.UI.createTab({ 
    title: ('Provider'), 
    window: win3 
}); 
win3.containingTab = tab3; 

self.addTab(tab1); 
self.addTab(tab2); 
self.addTab(tab3); 

return self; 

};

module.exports = ApplicationTabGroup;

的TableView

function CoreMeasures(title) { 
var self = Ti.UI.createWindow({ 
    title:.title, 
    backgroundColor:'white' 
}); 
//create table view data object 
var data = [ 
    {title: 'Pneumonia', hasChild : true, test: 'ui/common/pneumonia'}, 
    {title: 'CHF', hasChild: true, test:ui/common/CHF'}, 
    {title: 'Myocardial Infarction', hasChild: true, test: 'ui/common/Myocardial Infarction'}; 
] 




// create table view 
for (var i = 0; i < data.length; i++) { 
var d = data[i]; 
if(d.touchEnabled !==false) { 
    d.color = '#000' 
    data:data 
}); 

// create table view event listener 
tableview.addEventListener('click', function(e) 
{ 
    if (e.rowData.test) 
    { 
     var ExampleWindow = require(e.rowData.test), 
      win = new ExampleWindow({title:e.rowData.title,containingTab:self.containingTab,tabGroup:self.tabGroup}); 
     if (Ti.Platform.name == "android") { 

     } else { 
      win.backgroundColor = "#fff" 
+0

你永遠不會創建'CoreMeasures'的實例 – 2013-04-28 03:43:13

回答

0

幾件事情。我沒有看到任何你稱之爲CoreMeasures的功能。您也可能會遇到以下代碼問題:

function CoreMeasures(title) { 
var self = Ti.UI.createWindow({ 
    title:.title, 
    backgroundColor:'white' 
}); 

我注意到您的標題之前的一個點。

相關問題