Reputation: 2171
I have a tableview that accepts login credentials. I would like to have my app automatically select the first tableview text box upon loading or appearing. I would like the cursor to be placed in the "Email Address" field and for the keyboard to be raised automatically. I can't seem to figure this out. Anyone have any ideas? Thank you!
Upvotes: 4
Views: 904
Reputation: 4279
- (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];
}
Upvotes: 2
Reputation: 2980
You have to assign the first responder to that UITextView
...
For example:
[textField becomeFirstResponder]
You can do it in the viewDidAppear of the UIViewController.
Upvotes: 6