Created
April 16, 2015 10:14
-
-
Save rajubd49/730dc8d629a6da81ac43 to your computer and use it in GitHub Desktop.
Flip between views-iOS - Appcelerator Titanium
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 state = true; | |
var window = Titanium.UI.createWindow({ | |
backgroundColor: '#ffffff', | |
height: Ti.UI.FILL, | |
width: Ti.UI.FILL | |
}); | |
var view = Ti.UI.createView({ | |
top:165, | |
width:300, | |
height:140 | |
}); | |
window.add(view); | |
var front = Ti.UI.createView({ | |
backgroundColor:'red', | |
width:300, | |
height:140, | |
touchEnabled: false | |
}); | |
var back = Titanium.UI.createView({ | |
backgroundColor:'green', | |
width:300, | |
height:140, | |
touchEnabled: false | |
}); | |
view.add(front); | |
view.addEventListener('click', function(e) { | |
switch (state) { | |
case true: | |
Ti.API.info('true'); | |
view.animate({ | |
view: back, | |
transition:Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT | |
}); | |
break; | |
case false: | |
Ti.API.info('false'); | |
view.animate({ | |
view: front, | |
transition:Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT | |
}); | |
break; | |
} | |
state = !state; | |
}); | |
window.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment