Skip to content

Instantly share code, notes, and snippets.

@reymundolopez
Created December 3, 2012 01:11
Show Gist options
  • Select an option

  • Save reymundolopez/4191987 to your computer and use it in GitHub Desktop.

Select an option

Save reymundolopez/4191987 to your computer and use it in GitHub Desktop.
Titanium - How to hide a Picker/DatePicker emulating blur (lost focus)
// To hide the picker clicking on any other section of the screen use the following code:
var win = Ti.UI.createWindow();
var view = Ti.UI.createView({
bottom : 0
});
var picker = Ti.UI.createPicker({
bottom : 0,
type:Ti.UI.PICKER_TYPE_DATE,
minDate:new Date(1930,0,1),
maxDate:new Date(),
value:new Date(2012,1,1)
});
view.addEventListener("click", function(e){
picker.hide();
win.remove(view);
});
win.open();
win.add(view);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment