titanium mobile date picker from text field

北慕城南 提交于 2019-12-08 06:40:47

问题


I want to do the following: when people click on a text field they see a date picker. they click "done" button at the top and the date picker disappears and they are back on the form. How can I accomplish this using titanium mobile for iphone ios?


回答1:


You can use Textbox AddeventListener and Animation function. like

var donebtn = Ti.UI.createButton({
title : "Done",

});

var toolbar_pick    = Ti.UI.iOS.createToolbar({
      backgroundColor : "#f00",
      bottom        : -50,
      items       :[donebtn],
      barColor      :'#000',

});

var _date = Ti.UI.createPicker({
    type:Ti.UI.PICKER_TYPE_DATE,
    minDate : new Date,
    bottom :-320 ,
});
donebtn.addEventListener('focus',function(){
     _date.animate({bottom:-270, duration: 500});
     toolbar_pick.animate({bottom:-50, duration: 500});

});
textbox.addEventListener('click',function(){
    _date.animate({bottom:0, duration: 500});
    toolbar_pick.animate({bottom:266, duration: 500});


});
win.add(_date);
win.add(toolbar_pick);

just for example can use own your requirement.

MRT



来源:https://stackoverflow.com/questions/12020915/titanium-mobile-date-picker-from-text-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!