Skip to content

Instantly share code, notes, and snippets.

@mignev
Created January 26, 2012 15:46
Show Gist options
  • Save mignev/1683387 to your computer and use it in GitHub Desktop.
Save mignev/1683387 to your computer and use it in GitHub Desktop.
Simple example of webview in appcelerator
// 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();
@pundu55
Copy link

pundu55 commented Mar 11, 2014

I don't see any close button when I run this code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment