ios - TableView ScrollToIndex When TextArea Is Focused -
i have tableview , and 1 of rows contains button. when user presses button, append row table contains text area. want new row @ top of tableview , keyboard open. here have tried:
function addnewcomment() { var newcomment = new newcomment(tableview.data[0].rows.length); //i add spacer if added row last in table, can still @ top of view var spacer = ti.ui.createtableviewrow({ height:250, backgroundcolor: 'white' }); //there 6 rows of information in table before comments start tableview.appendrow(spacer, {animated:false}); tableview.insertrowafter(5, newcomment, {animationstyle:titanium.ui.iphone.rowanimationstyle.down}); //the listener focuses text area ti.app.fireevent('newcommentaddedtoview'); tableview.scrolltoindex(6,{animated:true,position:ti.ui.iphone.tableviewscrollposition.top}); }
when runs, if last line of method isn't called. new row scrolls view not way top. scrolls view enough see typing in text area. can manually scroll row aligns top i'd automatically. there way accomplish this?
thanks in advance.
setting focus on textfield or textarea triggers scrolling place typing. try calling scrolltoindex after focus set in textarea.
Comments
Post a Comment