Show a new window/image on close
I'm lost again, probably on the wrong track. Any help is appreciated.
A new window (winB) is shown when the device is shaken. And there is a close button to go back to the previous window (winA). Now this winA is an imageView showing shake1.png.
What I would like to have is that, after I close the modal of winB, shake2.png is shown. How can I create that?
var win = Titanium.UI.currentWindow;
win.hideNavBar({animated:false});
hidden = true;
var opening = Titanium.UI.createImageView({
width:320,
height:432,
top:0,
image:'images/shake1.png',
disableBounce:true
});
win.add(opening);
Ti.Gesture.addEventListener('shake',function(e)
{
var w = Titanium.UI.createWindow({
barColor: '#000000'
});
var b = Titanium.UI.createButton({
title:'Close',
style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN
});
w.setLeftNavButton(b);
b.addEventListener('click',function()
{
w.close();
});
w.open({modal:true});
var webview = Titanium.UI.createWebView({
url:'randomquotes.html',
});
w.add(webview);
So which code do I need where to have shake2.png shown when the modal winB is closed? I'm stuck.
1 Answer
-
lsten to the 'win close' event instead of blur and focus. That worked for me.