Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form with UITableView

I'm creating a Form with UITableView, I want that when i click over any part of my row, get the focus on the textfield so I can write on it. Right now to focus on the textfield (yellow space) i have to click only over the textfield (see image). Name is the title (not editable) enter image description here

Thanks a lot

like image 520
Pach Avatar asked Jul 24 '26 16:07

Pach


2 Answers

Say you have a textField named myTextField that you want to have focused when selecting the first row in the table.

Do this in your didSelectRowAtIndexPath: method

if (indexPath.row == 0) {
    [myTextField becomeFirstResponder];
}
like image 109
Aniruddh Avatar answered Jul 26 '26 06:07

Aniruddh


In -didSelectRowAtIndexPath of the row, call [correspondingTextField becomeFirstResponder];

like image 44
Ravi Avatar answered Jul 26 '26 04:07

Ravi