Automatically select the first UITableView text field

I have a table view that accepts login credentials. I would like my application to automatically select the first tableview text field when it loads or appears. I would like the cursor to be placed in the "Email address" field and for the keyboard to lift automatically. I can not understand this. Does anyone have any ideas? Thanks!

enter image description here

+4
source share
2 answers

You must assign the first responder to this UITextView ...

For instance:

 [textField becomeFirstResponder] 

You can do this in viewDidAppear of the UIViewController.

+6
source
 - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; myTextField = (UITextField *)[cell viewWithTag:kMyTextFieldTag]; [myTextField becomeFirstResponder]; } 
+2
source

All Articles