zoukankan      html  css  js  c++  java
  • titanium开发教程0405从rows打开window

    1android无法打开,ios支持

    app.js

    // this sets the background color of the master UIView (when there are no windows/tab groups on it)
    Titanium.UI.setBackgroundColor('#000');
    
    // create tab group
    var tabGroup = Titanium.UI.createTabGroup();
    
    var win = Titanium.UI.createWindow({  
        title:"Tours",
        backgroundColor:"#FFFFFF",
        //navBarHidden:true, //Hide the nav bar for the window
        tabBarHidden:true //Hide the tab bar for the window
    });
    //Remember, we are hiding this tab through the property tabBarHidden above
    var tab = Titanium.UI.createTab({  
        icon:"KS_nav_views.png",
        title:"Tours",
        window:win
    });
    
    var data = [
    	{title:"Backpack Cal", leftImage:"images/01-backpack-cal-thumb.png", className:"tableRow"},
    	{title:"California Calm", leftImage:"images/02-calm-cal-thumb.png", className:"tableRow", hasDetail:true, customData:"This is custom row data"},
    	{title:"California Hotsprings", leftImage:"images/03-hotsprings-cal-thumb.png", className:"tableRow"},
    	{title:"Cycle California", leftImage:"images/04-cycle-cal-thumb.png", className:"tableRow"},
    	{title:"From Desert to Sea", leftImage:"images/05-desert-cal-thumb.png", className:"tableRow"},
    	{title:"Kids California", leftImage:"images/06-kids-cal-thumb.png", className:"tableRow", hasDetail:true, customData:"This is custom row data"},
    	{title:"Nature Watch", leftImage:"images/07-nature-watch-cal-thumb.png", className:"tableRow"},
    	{title:"Snowboard Cali", leftImage:"images/08-snowboard-cal-thumb.png", className:"tableRow",hasDetail:true,js:"external.js",dataToPass:"This data was passed in from the main window"},
    	{title:"Taste of California", leftImage:"images/09-taste-cal-thumb.png", className:"tableRow"}
    ]
    
    var tableView = Titanium.UI.createTableView({
    	data:data
    });
    
    tableView.addEventListener("click",function(e){
    	//Check the row's hasDetail property
    	if(e.source.hasDetail){
    		if(e.source.js){//Does the row have a pointer to an external js file?
    			//It does: Load that file
    			var w = Titanium.UI.createWindow({
    				title:e.source.title,//Take the title from the row
    				backgroundColor:"#FFFFFF",
    				dataToPass:e.source.dataToPass,
    				url:e.source.js//The url property of a window will load an external .js file for window contents (be sure that external file is properly formatted!)
    			});
    		}else{
    			//It doesn't: Create a window from scratch
    			var w = Titanium.UI.createWindow({
    				title:e.source.title,//Take the title from the row
    				backgroundColor:"#FFFFFF",
    			})
    			//Create some views for our window
    			
    			var label = Titanium.UI.createLabel({
    				text:"A newly opened window from the " + e.source.title + " row",
    				"auto",
    				height:"auto",
    				textAlign:"center"
    			});
    			
    			w.add(label)
    		}
    		//Slide-open the window
    		tab.open(w,{animated:true});//Try it without the animated:true and see what happens
    	}else{//Row doesn't have a window to open
    		alert("No window to open :(")
    	}
    });
    
    win.add(tableView);
    
    tabGroup.addTab(tab);  
    
    // open tab group
    tabGroup.open();

    external.js

    //Create a pointer to the current window context
    var win = Titanium.UI.currentWindow;
    
    var label = Titanium.UI.createLabel({
    	text:win.dataToPass,//This text is loaded from variables passed into the window through the dataToPass property
    	"auto",
    	height:"auto",
    	textAlign:"center"
    });
    
    win.add(label);
  • 相关阅读:
    [EULAR文摘] 超声腱鞘炎对RA早期诊断的价值
    [EULAR文摘] 脊柱放射学持续进展是否显著影响关节功能
    第24周SDAI缓解能否预测远期RA骨破坏受抑制
    比较多普勒超声与临床缓解标准对RA放射学进展的预测效能
    血药谷浓度能否区分经TNF拮抗剂诱导获得缓解和低活动度的RA患者
    MRI病变能否预测已获临床缓解的早期RA未来放射学进展
    生物制剂时代的SpA研究正站在十字路口_Appel,Sieper2009
    【分享】操作配置文件帮助类
    MongoDB学习笔记-创建、更新、删除文档
    缓存学习笔记-1
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2403265.html
Copyright © 2011-2022 走看看