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