var eventHome=Ti.UI.createWindow({ background:"#000" }) var categoryListing=Ti.UI.createView({ width:270, backgroundColor:"red", zIndex:1 }) var mainModules=Ti.UI.createView({ width:260, backgroundColor:"green", zIndex:2 }) var MainView=Ti.UI.createView({ top:0, backgroundColor:"blue", zIndex:3, shadow:{ shadowRadius:5, shadowOpacity:0.7, shadowOffset:{x:-10, y:0} } }) var btn=Ti.UI.createButton({ title: '|||', style: Ti.UI.iPhone.SystemButtonStyle.BORDERED, zIndex:4, top:0, left:7 }) btn.addEventListener('click', function(e) { if(MainView.getLeft() == 0 ){ MainView.animate({ left:270, duration:500, curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT }) }else{ MainView.animate({ left:0, duration:500, curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT }) } }); eventHome.add(categoryListing) eventHome.add(mainModules) eventHome.add(MainView) eventHome.add(btn) eventHome.open()
2 Answers
var eventHome=Ti.UI.createWindow({
background:"#000"
})
var categoryListing=Ti.UI.createView({
width:270,
height:40,
top:150,
backgroundColor:"red",
zIndex:1
}) var mainModules=Ti.UI.createView({
width:260,
backgroundColor:"green",
zIndex:2,
height:40,
width:30,
top: 100
}) var MainView=Ti.UI.createView({
top:0,
backgroundColor:"blue",
zIndex:3,
height:30,
width:30,
shadow:{
shadowRadius:5,
shadowOpacity:0.7,
shadowOffset:{x:-10, y:0}
}
}) var btn=Ti.UI.createButton({
title: '|||',
style: Ti.UI.iPhone.SystemButtonStyle.BORDERED,
zIndex:4,
top:0
})
btn.addEventListener('click', function(e) {
if(MainView.getLeft() == 0 ){
MainView.animate({
left:270,
duration:500,
curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT
})
}else{
MainView.animate({
left:0,
duration:500,
curve:Ti.UI.ANIMATION_CURVE_EASE_IN_OUT
})
}
});
eventHome.add(categoryListing)
eventHome.add(mainModules)
eventHome.add(MainView)
eventHome.add(btn)
eventHome.open()
Just try this code....
var eventHome = Ti.UI.createWindow({ background : "#000" }); var categoryListing = Ti.UI.createView({ top : 50, left : 0, height : 200, width : 320, backgroundColor : "red", }); var mainModules = Ti.UI.createView({ top : 50, left : 0, height : 200, width : 320, backgroundColor : "green", }); var btn = Ti.UI.createButton({ title : '|||', style : Ti.UI.iPhone.SystemButtonStyle.BORDERED, zIndex : 4, top : 0, left : 7 }); var flag = true; btn.addEventListener('click', function(e) { if (flag) { mainModules.animate({ left : 320, duration : 500 }); } else { mainModules.animate({ left : 0, duration : 500 }); } flag = !flag; }); eventHome.add(categoryListing) eventHome.add(mainModules) eventHome.add(btn) eventHome.open()i think this what you are looking for....
Your Answer
Think you can help? Login to answer this question!