Time for action – adding a new window
Perform the following steps to add a new window:
Add a new window and create a tab for it in the same way as in the earlier example from this chapter:
var winSettings = Ti.UI.createWindow({ }); var tabSettings = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Settings', window:winSettings });
Add the new tab to the tab group:
tabGroup.addTab(tabSettings);
In an attempt to keep the
app.js
file tidy we will place the code to create the settings layout in a function at the top of the file:function setupSettings() { }
The
setupSettings
function will create a settings layout that will be built on a view. The view will be returned from the function. Make changes to the function code by adding the following code:function setupSettings() { var view = Ti.UI.createView({}); return view; }
This view can be added to the
winSettings
window by adding the code highlighted in the folowing code. The code adds the return value, which...