Hi ,
I tried the following code , but whenever i try to run the code on iPad its not showing anything..but on iPhone its working fine. The alerts are also not coming. I am using 2.1.1 as titanium sdk
app.js
if (Ti.Platform.osname == 'ipad') { alert('ipad') var ipad_win1=Ti.UI.createWindow({ navBarHidden:true, backgroundImage:'pics/about_ipad.png' }); ipad_win1.open(); } else{ alert('iphone') // 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({ backgroundImage:'pics/about_iphone.png', navBarHidden:true }); var tab1 = Titanium.UI.createTab({ icon:'pics/about.png', title:'About', window:win1 }); // // create controls tab and root window // var win2 = Titanium.UI.createWindow({ navBarHidden:true, backgroundImage:'pics/bg_iphone.png' }); var tab2 = Titanium.UI.createTab({ icon:'pics/movie.png', title:'Video', window:win2 }); //// // // add tabs // tabGroup.addTab(tab1); tabGroup.addTab(tab2); // open tab group tabGroup.open(); }
2 Answers
Hi Mathew
When in the iPad mode you have asked it to create a window and open in outside of the tabGroup - it will not slide the current window to the left showing this coming in from the right.
But you need to add one more parameter to get it to display in the way I think you want it.
var ipad_win1 = Ti.UI.createWindow({ navBarHidden: true, modal: true, // this one backgroundImage: 'pics/about_ipad.png' });By adding the modal window it shows the window over the top of the tabGroup.
Please note you will need some way of closing it of course.
Try that and let me know.
Or, totally ignore everything and use alert(Ti.Platform.osname)
If you get something, you know it works and your code doesn't.
Your Answer
Think you can help? Login to answer this question!