Titanium保存上次查看窗口的状态 [英] Titanium Saving the state of the last window viewed
问题描述
我该如何保存应用程序最后一次查看的窗口的状态?
How would i go about saving the state of the last viewed window of my application?
我一直在尝试Titan.app.properties,但是没有运气.我正在使用MVC
,所以所有内容都被拆分成单独的文件.我会在模型中创建几个全局变量,然后使用app.properties调用它们来解决这个问题吗?如果可以提供帮助,请您举个例子吗?
I have been trying titanium.app.properties with no luck. I am using MVC
so everything is split up into separate files. Would I go about this by making a couple of global variables in the model, and calling them with app.properties? If you can help, could you please provide an example?
感谢您的帮助< 3
Thanks for any help <3
推荐答案
因此,我已经能够通过简单地按照另一个答案中的说明进行操作.给任何有兴趣的人
So i have been able to get it to work by simply doing as stated in another answer. for anyone interested It goes as follows
//This decides what screen it should open
var lastwin = Ti.App.Properties.getString("lastwin");
if ( lastwin == 'SavedList'){
SavedList.open();
SavedListNav.open();
}
else if (lastwin == 'tomList'){
tomList.open();
TomNav.open();
}
else if (lastwin == 'Recipes'){
Recipes.open();
RecipesNav.open();
}
else MainMenu.open();
//in each function that leads to the specific screen you want do it like so
SavedListsBTN.addEventListener('click', function(e){
Ti.App.Properties.setString("lastwin", 'SavedList');
SavedList.open();
SavedListNav.open();
MainMenuNav.close();
MainMenu.close();
});
这篇关于Titanium保存上次查看窗口的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!