用钛将一个窗口移动到另一个窗口
Moving one window to another in titanium
my 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();
//
// create base UI tab and root window
//
var homeWindow = Titanium.UI.createWindow({
backgroundColor:'#fff',
url:'home.js',
backgroundImage:'appImage/background.png',
navBarHidden:true
});
var homeTab = Titanium.UI.createTab({
icon:'appImage/home.png',
size:{height:10,width:10},
title:'Home',
backgroundColor:'#999',
window:homeWindow
});
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff',
url:'win2.js'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
//win2.add(label2);
// win3
var win3 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff',
url:'win3.js'
});
var tab3 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 3',
window:win3
});
//win3.add(label2);
// win4
var win4 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff',
url:'win4.js'
});
var tab4 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 4',
window:win4
});
//win5
var win5 = Titanium.UI.createWindow({
title:'Tab 5',
backgroundColor:'#fff',
url:'win5.js'
});
var tab5 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 5',
window:win5
});
//win6
var win6 = Titanium.UI.createWindow({
title:'Tab 6',
backgroundColor:'#fff',
url:'win6.js'
});
var tab6 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 6',
window:win6
});
//
// add tabs
//
tabGroup.addTab(homeTab);
tabGroup.addTab(tab2);
tabGroup.addTab(tab3);
tabGroup.addTab(tab4);
tabGroup.addTab(tab5);
//tabGroup.addTab(tab6);
// open tab group
tabGroup.open();
我的家.js
var txtLogoImage = Ti.UI.createImageView({
image:'appImage/txtLogo.png',
height:30,
width:170,
top:15,
});
var loginButton = Ti.UI.createButton({
title: 'Login',
//image:'appImage/atm.png',
backgroumdImage:'appImage/buttonbg.png',
top: 90,
height:30,
width:170,
});
loginButton.addEventListener('click',function(event){
//How can I go to the win2???
});
var atmLocatorButton = Ti.UI.createButton({
title: 'ATM Locator',
top: 130,
height:30,
width:170
});
var branchLocatorButton = Ti.UI.createButton({
title: 'Branch Locator',
top: 170,
height:30,
width:170
});
var cityTouchLogoImage = Ti.UI.createImageView({
image:'appImage/citytouchlogo.png',
top:250,
left:'150',
height:100,
widht:250
});
Ti.UI.currentWindow.add(txtLogoImage);
Ti.UI.currentWindow.add(loginButton);
Ti.UI.currentWindow.add(atmLocatorButton);
Ti.UI.currentWindow.add(branchLocatorButton);
Ti.UI.currentWindow.add(cityTouchLogoImage);
当有人点击登录按钮时,我想移动win2(Tab2)。我该怎么做?
如果要
从任何位置切换选项卡,请将其添加到定义选项卡组的位置,在本例中为应用.js:
Ti.App.addEventListener('app:gotoTab', function(e) {
tabGroup.setActiveTab(e.tab);
});
将此添加到您的登录事件侦听器:
// tab index starts with 0, so 0 is your first tab
Ti.App.fireEvent('app:gotoTab', { tab: 1 });
相关文章:
- 创建一个类似链接的按钮,并通过Javascript函数打开一个新的弹出窗口
- 用javascript将数据从一个窗口传递到另一个窗口
- 构建JS测试,警报窗口重复上一个Q,而不是问下一个Q
- 创建一个方法,通过一个窗口进行迭代并获取Titanium中的所有控件
- 当满足PHP条件时显示一个弹出窗口
- 按下一个HTML按钮,该按钮使用一个功能在同一个新窗口中打开URL
- 想要打开从链接到另一个页面的模式弹出窗口
- 为位于路线上的谷歌地图标记(起点和终点)设置一个信息窗口
- 如何打开一个新窗口或选项卡,并将其提供给javascript执行
- 在屏幕中间打开一个弹出窗口
- window.open:是否可以通过修改DOM来打开一个新窗口
- 有没有一种方法可以检测何时触发了溢出-y:auto,并因此创建一个弹出窗口
- 我需要帮助弄清楚一旦窗口的垂直高度被滚动,如何切换一个元素
- 获取上一个和当前窗口宽度
- 从另一个窗口访问document.getElementById
- 将jquery ui窗口的父元素设置为另一个元素
- 从另一个dojo模板窗口小部件调用dojo模板小部件中的函数
- notify.js没有'如果另一个窗口被聚焦,则不显示通知
- Bootbox,两个模式窗口-一个在另一个之上
- 如何给这个弹出窗口一个滚动条