I can get the back button to work just fine in android, but the close button in the iphone area does not work at all. can anyone assist with this? it is just like how it says to do it in the tutorials, but still i am getting nothing... the iphone var close button is at the very end of the actual code. i figured i show you the rest of the action going on, pretty basic... here is the code:
var win = Titanium.UI.createWindow({ title:"title", backgroundColor:"#FFFFFF",
})
// label here var label = Titanium.UI.createLabel({
backgroundImage: "images/button.png",
top: 0,
width: "100%",
height: "12%",
textalign: "center",
})
// new button
var openWebpagenotification = Titanium.UI.createButton({ title:"button 1", backgroundImage: "images/button1.png", width:"100%", height:"12%", top:"10%", id: "button 1", url:"http://www.google.com",
});
openWebpagenotification.addEventListener("click", function(e){
// Create a window and add a webview to it that opens your url:
var webviewWindow = Titanium.UI.createWindow({title: 'button 1', fullscreen: false});
var myWebView = Ti.UI.createWebView({url:e.source.url});
webviewWindow.add(myWebView);
// Will need a button to close the new window for iphones.................................
var closeButton = Titanium.UI.createButton({title:'Close', style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN}); webviewWindow.setLeftNavButton(closeButton);
webviewWindow.open(); // Open your new window
})
2 Answers
Accepted Answer
Hi paul wamser,
Try to open window in Modal and also set click event of your close button.
closeButton.addEventListener('click',function(evt){ webviewWindow.close(); }); webviewWindow.open({modal:true});
great. thank you so much! that definitely worked!
Your Answer
Think you can help? Login to answer this question!