Created
August 7, 2012 04:50
-
-
Save mauropm/3281739 to your computer and use it in GitHub Desktop.
Facebook 'alike' menu in Appcelerator
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
/* | |
* 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