Skip to content

Instantly share code, notes, and snippets.

@mauropm
Created August 7, 2012 04:50
Show Gist options
  • Save mauropm/3281739 to your computer and use it in GitHub Desktop.
Save mauropm/3281739 to your computer and use it in GitHub Desktop.
Facebook 'alike' menu in Appcelerator
/*
* Facebook 'alike' menu in Titanium Appcelerator
* Mauro Parra-Miranda <[email protected]>
* License: Free to use, no support at all.
* USAGE: Create a new mobile project in Ti Studio, paste this file into app.js
*/
var win = Ti.UI.createWindow({
backgroundColor : 'white',
});
var tableData = [];
for (var i = 0; i < 10; i++) {
tableData.push({
title : 'Row #' + (i + 1)
});
}
var table = Ti.UI.createTableView({
top : 0,
left : 0,
bottom : 0,
right : 40,
zindex :1,
search : Ti.UI.createSearchBar(),
data : tableData
});
var mainView = Ti.UI.createView({
top:0,
left:0,
zindex:2,
backgroundColor:'white',
});
var icon = Ti.UI.createImageView({
image:'KS_nav_ui.png',
top:0,
left:0,
zindex:3,
});
icon.addEventListener('click',function(e){
if(mainView.left==0){
mainView.animate({left:Ti.Platform.displayCaps.platformWidth-43,duration:30});
mainView.left=Ti.Platform.displayCaps.platformWidth-43;
} else {
mainView.animate({left:0,duration:30});
mainView.left=0;
}
});
var contentView = Ti.UI.createView({
left:0,
top:43,
zindex:3,
backgroundColor:'red',
});
mainView.add(icon);
mainView.add(contentView);
win.add(table);
win.add(mainView);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment