I have a main window (app.js) and two sub-windows (login.js and signUp.js)
Here is my app.js
var login=Titanium.UI.createWindow({
url:'wins/login.js',
title:'Login',
backgroundColor:'#CCC',
navBarHidden:true
});
var signUp=Titanium.UI.createWindow({
url:'wins/signUp.js',
title:'Sign-up',
backgroundColor:'#CCC',
navBarHidden:true
});
login.open({fullscreen:true});
Now I want to open signUp.js from with login.js. Is there any way to do this? I've tried googling and reading over the documentation开发者_高级运维 to no avail.
just typed this up, not perfect, but this is the general idea.
// create buttons on main window
var loginBtn = Titanium.UI.createButton({
title : 'LOGIN'
});
var signUpBtn = Titanium.UI.createButton({
title : 'SIGN UP'
});
// add to window
mainWindow.add(loginBtn);
mainWindow.add(signUpBtn);
// associate click events
loginBtn.addEventListener('click', function() {
Ti.API.log('loginBtn button clicked, show window');
login.open();
});
signUpBtn.addEventListener('click', function() {
Ti.API.log('signUpBtn button clicked, show window');
signUp.open();
});
精彩评论