开发者

UITextField in UITableView to becomeFirstResponder

I have a problem which I dont have a clue how to work around. Maybe anyone of you coul开发者_运维技巧d help me to the correct directions...

Simple I have a UITableView with each cell containing a UITextField. When I´m editing a cell (UITextField) and hit Return Key, a new row is inserted under the current cell. After that I reloadData on the TableView, the new row is showed. Everything is OK here.

Now to my problem, I want to [UITextField becomeFirstResponder] on the newest added row. But I could not find anyway to accomplish this. I could post code but didn't find that necessary.

Cheers.


You should somehow be able to get the indexPath of the last inserted row. If you have this indexPath you can call the cellForRowAtIndexPath: method of the tableView.

Now you have the last inserted cell and can call the becomeFirstResponder method of the textfield (do you have a custom made cell?).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜