Created
January 26, 2012 15:46
-
-
Save mignev/1683387 to your computer and use it in GitHub Desktop.
Simple example of webview in appcelerator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
Titanium.UI.setBackgroundColor('#000'); | |
// create tab group | |
var tabGroup = Titanium.UI.createTabGroup(); | |
// | |
// create base UI tab and root window | |
// | |
var win1 = Titanium.UI.createWindow({ | |
title:'Tab 1', | |
backgroundColor:'#fff' | |
}); | |
var tab1 = Titanium.UI.createTab({ | |
icon:'KS_nav_views.png', | |
title:'Tab 1', | |
window:win1 | |
}); | |
var tweetButton = Ti.UI.createButton({ | |
title:'Tweet', | |
height:35, | |
left:10, | |
right:10 | |
}); | |
win1.add(tweetButton); | |
tweetButton.addEventListener('click', function(data) { | |
var tweetWindow = Titanium.UI.createWindow(); | |
var webview = Titanium.UI.createWebView({ | |
url:'http://www.google.com' | |
}); | |
tweetWindow.add(webview); | |
tweetWindow.open({ | |
modal:true | |
}); | |
var closeTweetButton = Titanium.UI.createButton({ | |
title:'Close' | |
}); | |
closeTweetButton.addEventListener('click', function() { | |
tweetWindow.close(); | |
}); | |
tweetWindow.setLeftNavButton(closeTweetButton); | |
}); | |
// | |
// add tabs | |
// | |
tabGroup.addTab(tab1); | |
// open tab group | |
tabGroup.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't see any close button when I run this code