1) Add the delegate UITextFieldDelegate to your ViewController,
@interface ViewController ()<UITextFieldDelegate>
2) implement the textFieldShouldReturn method
-(BOOL) textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
3) change your switch in the tableView cellForRowAtIndexPath method,
switch (indexPath.row) {
case 0:{
tfA1 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA1.delegate = self;
}
break;
case 1:{
tfA2 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA2.delegate = self;
}break;
case 2:{
tfA3 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA3.delegate = self;
}break;
case 3:{
tfA4 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA4.delegate = self;
}break;
case 4:{
tfA5 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA5.delegate = self;
}break;
case 5:{
tfA6 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA6.delegate = self;
}break;
case 6:{
tfA7 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA7.delegate = self;
}break;
case 7:{
tfA8 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA8.delegate = self;
}break;
case 8:{
tfA9 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA9.delegate = self;
}break;
case 9:{
tfA10 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA10.delegate = self;
}break;
case 10:{
tfA11 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA11.delegate = self;
}break;
case 11:{
tfA12 = (UITextField*)[cell viewWithTag:nextIndexPathRow];
tfA12.delegate = self;
}break;
}