No matter what I try, I can't preserve the top navbar so users can go back. I'm new to windows and modal and can't get it to not load over the entire page and navbar.
// create main day window var dayWindow = Titanium.UI.createWindow({ id: 'win1', title: 'Schedule', backgroundColor: '#fff', barColor: '#414444', fullscreen: false }); var webview = Titanium.UI.createWebView({url:'http://www.appcelerator.com'}); var window = Titanium.UI.createWindow(); window.add(webview); window.open({modal:true}); return dayWindow;
3 Answers
you need to either use a navigationController OR open the windows using a tabGroup to get the effect you are looking for.
When you use "modal" it will create a completely new navigation bar and you will have to create your own left and right buttons to take the appropriate action
//in 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 win1 = Titanium.UI.createWindow({
title:'app.js',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab',
window:win1
});
var button= Ti.UI.createButton({ title:'open new window' })
button.addEventListener('click',function(){
var win= Ti.UI.createWindow({
title:'new window',
url:'new.js'
})
tab1.open(win);
})
win1.add(button);
tabGroup.addTab(tab1);
// open tab group tabGroup.open();
//create a fiel named new.js and in new.js
var wind= Ti.UI.currentWindow;
Window was being created over the existing one. I changed it to simply load into the current window.
var win = Titanium.UI.currentWindow;
Your Answer
Think you can help? Login to answer this question!