Hi there,
Im new to both appcelerator and mobile development and find I am having a little trouble doing what is probably the most basic of tasks...structure set up.
I want to create an app that consists of several "pages" linked through the usual actions of registration->login->my account (for example) but find that I am unable to do this in the way I have tried/would have liked.
I have started by creating a series of windows that I try to open and close (modally) when clicking on the various links and buttons and find that the first two windows transition as I would expect. However I then start to experience problems going from the second to the Third window. I often find I am presented with a debug message of "we still care about is rooviewattached!!" (or something along those lines). Additionally the windows no longer transition correctly.
Am I appraoching this in the right way? Its all going well until I try to drill down past level two. I've had a look around and haven't found anything to say I can't do it this way/do it a better way.
Any suggestions would be very warmly received. And apologies for the basic question!
Cheers, Paul
4 Answers
Paul, two things: <br><br> 1. I'm not sure that "modal:true" does what you think it does. I had a conceptual issue with this when I first started with Titanium also. In Windows desktop development (I use Delphi), a "modal" window is one which must be closed before any other interaction is allowed with any other window in the program. In Titanium, I think it has something to do with taking over the entire screen of the device, including the bar at the top that has the signal bars, time, battery indicator, etc. (the "status bar"...is that what it's called?). <br><br> 2. Don't try to create too many windows at once. I see that win3 can only be opened from win2. Since that's the case, there's no need to create win3 inside of win1's js file...just create it in win2's js file. <br><br> > Basically I'm looking for advice on the most efficient way > to create a multi-page application in terms of page switching. << <br><br> Have win1's open1 button create win2 with a "url" property set to something like "win2.js". In win2.js, create the open3 and close2 buttons, and then .add them to win2 (which would be set to Titanium.UI.currentWindow at the top of win2.js). In this way, every winX.js file takes care of it's own sub-component creation and event listeners, and creating the next window.
Please widdle your code down to a simple example, and post the code here so we can see what you're doing. Also, android or iphone? Show your current SDK version as well.
Hi,
Yes sorry should maybe have provided a little more information. I am currently just looking at iphone dev and the SDK version I am using is 1.7.1.
Here is a shortish bit of code where I have tried to create three levels of windows:
~~~
var Events = {};
Ti.include('ui/layout.ui.js'); Ti.include('ui/events.ui.js');
var win1Title = 'Root window'; var win2Title = 'Win 2'; var win3Title = 'Win 3';
var win = Titanium.UI.currentWindow;
/* ########################### */ var open1 = Ti.UI.createButton({ title : 'open window 2' ,width : 75 ,height : 30 });
win.add(open1);
/* ########################### */
var win2 = Ti.UI.createWindow({ backgroundColor : 'blue' ,tabBarHidden : true ,title : win2Title ,top : 43 });
var open3 = Ti.UI.createButton({ title : 'open window 3' ,height : 30 ,width : 75 });
var close2 = Ti.UI.createButton({ title : 'close window 2' ,height : 30 ,width : 75 ,top: 140 });
win2.add(open3); win2.add(close2);
/* ########################### */
var win3 = Ti.UI.createWindow({ backgroundColor : 'red' ,tabBarHidden : true ,title : win3Title ,top : 43 });
var close3 = Ti.UI.createButton({ title : 'close window 3' ,height : 30 ,width : 75 ,top: 190 });
win3.add(close3);
/* ########################### EVENT LISTENERS */
open1.addEventListener('click', function(e){ win2.open({modal:true}); });
close2.addEventListener('click', function(e){ win2.close(); });
close3.addEventListener('click', function(e){ win3.close(); });
open3.addEventListener('click', function(e){
win3.open({modal:true});
});
~~~~~
Basically I'm looking for advice on the most efficient way to create a multi-page application in terms of page switching. Can opening and closing windows be done modally as this seems to be the reason I get the 'isrootviewattached!!!' message.
Thanks, Paul
Hi,
Could you please provide a follow up. What method did you end up using?
Thanks
Your Answer
Think you can help? Login to answer this question!