ios - UITextField becomeFirstResponder is not working inside dynamic cell -


i have uitextfield inside first cell of uitableview, whenever changes table changing too. problem when table updated field loses first responder status , becomefirstresponder doesn't make first responder again - keyboard disappears.

i call [_searchfield becomefirstresponder] in tableview:didenddisplayingcell:forrowatindexpath: keyboard disappears anyway. update: tried calling becomefirstresponder in cellforrowatindexpath before, didn't work too. _searchfield outlet property of class of cell connected field.

where should call becomefirstresponder field becomes first responder? or maybe should somehow differently field doesn't lose first responder status? tried refreshing not whole table, separate sections (search field in own section), didn't work, controller tried show cells didn't exist anymore, prefer refreshing whole table.

i know can use special search controller, didn't design, implemented way...

thanks!

actually, should've called becomefirstresponder after [self.tableview reloaddata] in same method, instead of trying find method called after table refresh inside uitableviewcell subclass or in uitableviewcontroller class.

i didn't in first place, probably, didn't have reference cell in place [self.tableview reloaddata] called.

that's worked (sopsearchcell subclass of uitableviewcell, self uitableviewcontroller subclass instance):

[self.tableview reloaddata] // make searchfield first responder again nsuinteger indexes[] = {0, 0}; nsindexpath *indexpath = [nsindexpath indexpathwithindexes:indexes length:2]; sopsearchcell *cell = (sopsearchcell *)[self.tableview cellforrowatindexpath: indexpath]; [cell.searchfield becomefirstresponder]; 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -