2011-08-12 8 views
0

UITextField가 포함 된 사용자 지정 UITableViewCell을 사용하고 있습니다. 이 코드와 jQuery과 5 번이있는 UITableViewCell을 그릴 :사용자 정의 UITextViewCell에서 텍스트를 가져 오는 방법은 무엇입니까?

사용자가 다섯 개 셀에 데이터를 inputed 한
InputCellTableViewCell *cell = [tableViewIn dequeueReusableCellWithIdentifier:@"inputCell"]; 

[cell setUp]; //Just sets first responder and delegate. 

[cell.textField setPlaceholder:[self.arrayWithFields objectAtIndex:indexPath.row]]; 
return cell; 

, 어떻게 가장 좋은 방법 O를 셀 데이터의 각 액세스하고 저장합니까? 볼 수 있듯이 각 셀에 대한 규정이 없습니다.

답변

0

당신은

if (indexPath.section == 0) { 

     // Add a UITextField 
     UITextField *textField = [[UITextField alloc] init]; 
     // Set a unique tag on each text field 
     textField.tag = indexPath.row; 
     [cell.contentView addSubview:textField]; 
     [textField release]; 
    } 
    if (indexPath.section == 1) { 

     // Add a UITextField 
     UITextField *textField = [[UITextField alloc] init]; 
     // Set a unique tag on each text field 
     textField.tag = indexPath.row; 
     [cell.contentView addSubview:textField]; 
     [textField release]; 
    } 
+0

가 작동하지 않습니다 각 셀에 대한 귀하의 UITextField에 대한 태그를 사용할 수 있습니다. 다른 방법으로이 세포를 얻고 그 태그를 물어볼 수 있습니까? –

+0

그렇다면 textField (릴리스하지 마십시오)에 대한 전역 변수를 만들고 태그가있는 다른 메서드에서 사용하십시오. –

관련 문제