Xcode 如何从自定义UITextViewCell获取文本?
我正在使用包含UITextField的自定义UITableViewCell。我使用以下代码在UITableView中绘制此UITableViewCell 5次:Xcode 如何从自定义UITextViewCell获取文本?,xcode,uitableview,uitextfield,Xcode,Uitableview,Uitextfield,我正在使用包含UITextField的自定义UITableViewCell。我使用以下代码在UITableView中绘制此UITableViewCell 5次: InputCellTableViewCell *cell = [tableViewIn dequeueReusableCellWithIdentifier:@"inputCell"]; [cell setUp]; //Just sets first responder and delegate. [cell.textField se
InputCellTableViewCell *cell = [tableViewIn dequeueReusableCellWithIdentifier:@"inputCell"];
[cell setUp]; //Just sets first responder and delegate.
[cell.textField setPlaceholder:[self.arrayWithFields objectAtIndex:indexPath.row]];
return cell;
当用户将数据输入到五个单元格中时,如何以最佳方式访问每个单元格数据并保存?
正如您所看到的,我没有每个单元格的偏差。您可以为每个单元格的UITextField使用标记
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];
}
不起作用。如何从另一个方法获取这些单元格并请求标记?好的,然后为textField创建全局变量(不要释放),并在另一个带有标记的方法中使用它。