I have done my first iphone app with Titanium but while optimizing the code, I noticed something.
I have used multiple windows (and a single view for each window) while developing my iphone app.
Now, my question is, what do you suggestion?
A single window (view controller) and multiple views inside the view controller window OR multiple windows with a single view inside each window?
What do you suggest?
Thanks.
5 Answers
Hi Kenan,
It doesn't seem an exact science, but there are a few things I have considered when weighing it up:
How much common data/objects/processing is there between screens. How will the navigation work - back button/tabs/controls
The advantage of windows particularly on larger apps is it segregates your code and helps contain features (and functions) relating only to one area. The advantage of views is they work in the same context so also may help code reuse.
I'd say if you have screens with mostly specific functionality use windows and pass the data. If you have screens performing variations of the same thing (like a list displayed as either table or coverflow) have a window with multiple views. In the end you'll probably end up with a mix'n'match.
cheers Chris.
Hi Chris,
Thanks for your reply. I understand. So, I think multi-windows is the best way. The only problem ahead of me is to find a way to disable the "back" button on the window title bar. Then my app will be ready for submitting to app store :)
Cheers.
You could try overriding with a blank/invisible button using: Titanium.UI.currentWindow.setLefttNavButton(nonButton);
This is a bit of a hack, but your use-case, may mean that 'back' just isn't appropriate there.
have a play around with properties of the window, there's probably a combination that'll work.
"ready for submitting to the app store" - go for it
cheers, Chris.
Thanks Chris. I will try your suggestion.
Cheers.
Hi again Chris,
I just wonder how you achieve to create an invisible/hidden left button on windows title bar?
var HiddenButton = Titanium.UI.createButton({ enabled : false, touchEnabled : false, visible : false, }); var LoginWindow = Titanium.UI.createWindow({ backgroundColor : AppBackgroundColor, backButtonTitle : '', barColor : AppBackgroundColor, title : 'Windows Title', tabBarHidden : true, rightNavButton : SettingsButton, leftNavButton : HiddenButton });
Your Answer
Think you can help? Login to answer this question!