Appcelerator iOS: Move TableView up if soft keyboard comes up
var isKeyboardOpen = false; // used for the iOS keyboard open detection later.
// handles the iOS keyboard change event.
function onKeyboardFrameChanged(event) {
// first, calculate the new position.
var newListBottomPosition;
if (isKeyboardOpen) {
isKeyboardOpen = false;
newListBottomPosition = 0;
}
else {
isKeyboardOpen = true;
newListBottomPosition = event.keyboardFrame.height;
}
// Second, animate the table into the new position.
$.tableView.animate({
bottom: newListBottomPosition,
duration: event.animationDuration * 1000
});
}
// Bind events not set in Alloy.
OS_IOS && Ti.App.addEventListener('keyboardframechanged', onKeyboardFrameChanged);