Q:

How to add 12 text fields in a table view cell and access each text field's text by its tag value?

I want add 12 UITextFields in a UITableViewCell (one text field in each row), and access each UITextField's text by using it's tag. How can I do this?

A:

UITextField *textField = (UITextField *)[cell viewWithTag:1];
// 1 is your tag, and use textField.text to get the text in the textField.

Your code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//...
nameLabel.tag =1; // 1 is your nameLabel's tag
[tv setDelegate:self];
tv.tag = indexPath.row + 1; // set it to tv.tag = indexPath.row + 2; because 1 is your nameLabel's tag

UITextField *textField = (UITextField *)[cell viewWithTag:tv.tag];//
NSLog(@"%@",textField.text);

return cell;

