Skip to content

Instantly share code, notes, and snippets.

@exclusiveTanim
Created November 5, 2018 13:29
Show Gist options
  • Save exclusiveTanim/560cac203d4a6dfdde7b28246e049055 to your computer and use it in GitHub Desktop.
Save exclusiveTanim/560cac203d4a6dfdde7b28246e049055 to your computer and use it in GitHub Desktop.
Modified Test Code
var win1 = Ti.UI.createWindow({
backgroundColor : 'white',
title : 'Blue'
});
var btn = Ti.UI.createButton({
title : 'open home screen ',
top : 100
});
var mainNavWin;
var webview;
btn.addEventListener('click', function() {
tab1.open(getNavWin());
});
win1.add(btn);
var win2 = Ti.UI.createWindow({
backgroundColor : 'red',
title : 'Red'
});
win2.add(Ti.UI.createLabel({
text : 'I am a red window.'
}));
var tab1 = Ti.UI.createTab({
window : win1,
title : 'Blue'
}),
tab2 = Ti.UI.createTab({
window : win2,
title : 'Red'
}),
tabGroup = Ti.UI.createTabGroup({
tabs : [tab1, tab2],
navBarHidden : true
});
tabGroup.addEventListener('focus', function() {
webview && webview.setHtml('');
mainNavWin && mainNavWin.close();
});
tabGroup.open();
function getNavWin() {
var homeWin = Ti.UI.createWindow({
backgroundColor : 'white',
navBarHidden : true
});
mainNavWin = Ti.UI.iOS.createNavigationWindow({
window : homeWin
});
var btn = Ti.UI.createButton({
title : 'click to open videos',
color : 'white',
backgroundColor : 'black',
top : 10
});
homeWin.add(btn);
btn.addEventListener('click', function() {
mainNavWin.openWindow(getNextWindow());
});
return mainNavWin;
}
function getNextWindow() {
var win = Ti.UI.createWindow({
backgroundColor : 'white',
navBarHidden : true,
width : Ti.UI.FILL,
height : Ti.UI.FILL
});
var backBtn = Ti.UI.createButton({
title : 'BACK',
color : 'white',
backgroundColor : 'black',
top : 10,
left : 50
});
backBtn.addEventListener('click', function() {
mainNavWin.closeWindow(win);
});
var WK = require('ti.wkwebview');
webview = WK.createWebView({
url : 'https://vimeo.com/album/5202279',
top : 50
});
win.add(backBtn);
win.add(webview);
return win;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment