Alex Rivera | Logout

Telling a UITextField to become first responder while embedded in a UITableViewCell

Asked 2009-11-14T00:42:15.623
48

I have a UITextField that is a subview of a UITableViewCell.

When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I am trying:

[myTextField becomeFirstResponder];

This returns NO all the time, regardless of when it's called, which according to the docs means the text field refused to become first responder... What am I doing wrong?

Edit:

The textfield properly responds to being touched. It bring up the keyboard then. It's only when telling it to becomefirstresponder programmatically that the problem happens.

Edit
Report

2 Answers

1

I was not getting the cursor to show up when the UITextField was made first responder inside of the cellForRowAtIndexPath. The text field would work just fine and dandy, but it was not showing the blinking cursor inside of the field. When you would press and hold, the zoom magnify would also not show a cursor.

I got around this odd issue by setting my becomeFirstResponder inside of the didSelectRowAtIndex method.

answered 2010-05-10T18:27:44.327
0

Is your UITableView editing property set to YES?

answered 2009-11-14T01:01:48.517

Your Answer