In my app I use textFields in tableView. But When user click to the text field in the second cell I need to add one mor cell to table view (like mail.app), but how can I get number of cell, if i click to the text field?
I tried so
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath{
//some action
}
but this function didn’t start when I click to the textField inside the cell
For the text field inside your table view cell, set your view controller (or whatever you want) to conform to the
UITextFieldDelegateprotocol and set it as the text field delegate.Then, set the text field TAG property to equal the row number for the table view cell.
When the user clicks on the text field, you’ll get a delegate message sent to your
textFieldShouldBeginEditing:method and you’ll know the cell’s row number because you stored it in the tag property.I hope my answer helps you out!