Created
May 4, 2011 08:53
-
-
Save astronaughts/954949 to your computer and use it in GitHub Desktop.
Titanium mobile sample001
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
var tabGroup = Titanium.UI.createTabGroup(); | |
// tab に埋め込む window。hoge.js から読み込む | |
var hoge = Titanium.UI.createWindow({ | |
url: 'hoge.js' | |
}); | |
// tab を作る | |
var tab = Titanium.UI.createTab({ | |
title: 'hoge', | |
window: hoge | |
}); | |
tabGroup.addTab(tab); | |
tabGroup.open(); |
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
Titanium.UI.currentWindow.backgroundColor = '#00FF00'; | |
// fuga.js の window を閉じるための button を作る | |
var button = Titanium.UI.createButton({ | |
width: 100, | |
height: 50, | |
top: 195, | |
left: 110, | |
title: 'close' | |
}); | |
// button をクリックした時のイベント | |
button.addEventListener('click', function(e) { | |
Titanium.UI.currentWindow.close(); | |
}); | |
// button を window に追加 | |
Titanium.UI.currentWindow.add(button); |
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
Titanium.UI.currentWindow.backgroundColor = '#0000FF'; | |
// 別の window を開くための button を作る | |
var button = Titanium.UI.createButton({ | |
width: 100, | |
height: 50, | |
top: 150, | |
left: 110, | |
title: 'open' | |
}); | |
// button をクリックした時のイベント | |
button.addEventListener('click', function(e) { | |
// 別の window。fuga.js から読み込む | |
var fuga = Titanium.UI.createWindow({ | |
url: 'fuga.js' | |
}); | |
// fuga.js の window を開く | |
fuga.open(); | |
}); | |
// button を window に追加 | |
Titanium.UI.currentWindow.add(button); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment