Hi All,
I have to make a modal popup in one of my app. Where I have added a new window with a black background with opacity. And added a view to that window to show the custom message. Here is my code block.
exports.modalWin = function(){ var popupWin = Ti.UI.createWindow({ backgroundColor : 'black', opacity : 0.5, fullscreen : true }); var popupView = Ti.UI.createView({ width : 200, height : 100, backgroundColor : 'white', borderRadius : 5, borderColor : 'red', borderWidth : 3 }); popupView.add(Ti.UI.createLabel({ width : 150, height : 'auto', top : 10 , text : 'This is Modal Window', backgroundColor : 'green', font : { fontSize : 14, fontWeight : 'bold'}})); popupWin.add(popupView); popupWin.addEventListener('click', function(e){ popupWin.close()}); return popupWin; };Now my issues is that, I have a window click event which will close the popup window. But If click on the view resides within that window, the window should not closed. I have tested the above code in android.
Please point me if I am wrong anywhere.
1 Answer
what you can do you can add an click eventListener on your view or that window on which the popup is coming. write the popupWin.close code in there.
so when you touch the view or window the popup will also close.
Your Answer
Think you can help? Login to answer this question!