ios - How to set selection in UITextView? -
i have uitextview
placed inside uitableviewcell
. select content inside uitextview
, i'll use following code.
[uitextview select:self]; [uitextview setselectedrange:nsmakerange(start,length)];
once uitableview
loaded, following methods called
numberofrowsinsection:(nsinteger)section
cellforrowatindexpath:(nsindexpath *)indexpath
heightforrowatindexpath:(nsindexpath *)indexpath
my question , should place code uitextview
got focused.
thanks answers.
you should put code in viewdidappear
method. first, scroll target cell view make visible:
scrolltorowatindexpath:atscrollposition:animated:
then, cell want direct input:
cellforrowatindexpath:
now cast cell cell of type, grab uitextview
, make selection, , give focus.
Comments
Post a Comment