Skip to content

Instantly share code, notes, and snippets.

@mogya
Created September 5, 2011 12:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mogya/1194823 to your computer and use it in GitHub Desktop.
show various buttons without any images.
var tabGroup = Titanium.UI.createTabGroup();
var view = Titanium.UI.createView({
});
view.layout = 'vertical';
var win = Titanium.UI.createWindow({
title:'non-image buttons',
font:{fontFamily:'AppleGothic'},
tabBarHidden:true,
backgroundColor:'#fff'
});
win.add(view);
var tab1 = Titanium.UI.createTab({
window:win
});
tabGroup.addTab(tab1);
// system buttons.
var flexSpace = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});
var buttonReload = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.REFRESH
});
var buttonStop = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.STOP
});
var buttonCompose = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.COMPOSE
});
var buttonAction = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.ACTION
});
var buttonReload = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.REFRESH
});
var button1 = Titanium.UI.createButton({
title:'systemButton',
height:40
});
button1.addEventListener('click',function(){
win.setToolbar([flexSpace,buttonReload,flexSpace,buttonStop,flexSpace,buttonCompose,flexSpace,buttonAction,flexSpace]);
});
view.add(button1);
// Forward and back button for browser.
var buttonForward = Titanium.UI.createButton({
title:String.fromCharCode(0x25b6)
});
var buttonBack = Titanium.UI.createButton({
title:String.fromCharCode(0x25c0)
});
var button2 = Titanium.UI.createButton({
title:'browserButton',
height:40
});
button2.addEventListener('click',function(){
win.setToolbar([flexSpace,buttonBack,flexSpace,buttonStop,flexSpace,buttonReload,flexSpace,buttonForward,flexSpace]);
});
view.add(button2);
// OK. more buttons!
var buttonApple = Titanium.UI.createButton({
title:String.fromCharCode(0xf8ff)
});
var buttonCommand = Titanium.UI.createButton({
title:String.fromCharCode(0x2318)
});
var buttonOption = Titanium.UI.createButton({
title:String.fromCharCode(0x2325)
});
var buttonReturn = Titanium.UI.createButton({
title:String.fromCharCode(0x23ce)
});
var buttonForward2 = Titanium.UI.createButton({
title:String.fromCharCode(0x25c1)
});
var buttonBack2 = Titanium.UI.createButton({
title:String.fromCharCode(0x25b7)
});
var buttonNote1 = Titanium.UI.createButton({
title:String.fromCharCode(9833)
});
var buttonNote2 = Titanium.UI.createButton({
title:String.fromCharCode(9834)
});
var buttonNote3 = Titanium.UI.createButton({
title:String.fromCharCode(9835)
});
var button3 = Titanium.UI.createButton({
title:'moreButton',
height:40
});
button3.addEventListener('click',function(){
win.setToolbar([flexSpace,buttonForward2,buttonBack2,buttonApple,buttonCommand,buttonOption,buttonReturn,buttonNote1,buttonNote2,buttonNote3,flexSpace]);
});
view.add(button3);
// more more!
buttonWeather1 = Titanium.UI.createButton({
title:String.fromCharCode(0x2600)
});
buttonWeather2 = Titanium.UI.createButton({
title:String.fromCharCode(0x2601)
});
buttonWeather3 = Titanium.UI.createButton({
title:String.fromCharCode(0x2602)
});
buttonWeather4 = Titanium.UI.createButton({
title:String.fromCharCode(0x2603)
});
buttonStar1 = Titanium.UI.createButton({
title:String.fromCharCode(0x2605)
});
buttonStar2 = Titanium.UI.createButton({
title:String.fromCharCode(0x2606)
});
buttonTel1 = Titanium.UI.createButton({
title:String.fromCharCode(0x260E)
});
buttonTel2 = Titanium.UI.createButton({
title:String.fromCharCode(0x260F)
});
buttonWeather4 = Titanium.UI.createButton({
title:String.fromCharCode(0x2603)
});
var button4 = Titanium.UI.createButton({
title:'moreButton',
height:40
});
button4.addEventListener('click',function(){
win.setToolbar([flexSpace,buttonWeather1,buttonWeather2,buttonWeather3,buttonWeather4,buttonStar1,buttonStar2,buttonTel1,buttonTel2,flexSpace]);
});
view.add(button4);
tabGroup.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment