2012-05-17 29 views

回答

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

您的代碼:

- (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; 
相關問題