Skip to content

Instantly share code, notes, and snippets.

@rajubd49
Created April 16, 2015 10:14
Show Gist options
  • Save rajubd49/730dc8d629a6da81ac43 to your computer and use it in GitHub Desktop.
Save rajubd49/730dc8d629a6da81ac43 to your computer and use it in GitHub Desktop.
Flip between views-iOS - Appcelerator Titanium
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