カスタムテキストビューを含むテーブルビューセルがあります。テキストが編集/追加された後、テキストボックス内のテキストにどのようにアクセスできるのか疑問に思っています。
通常、IB を使用してテキスト フィールドを描画すると、これがどのように行われるかがわかりますが、textviewcell は動的に描画されます。
(つまり、detailLabel.text で更新されたデータをキャプチャしたい)
あなたの答えに適応するための関連コードは次のとおりです。再度、感謝します!
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
//Big Text Box
UITextView *detailLabel = [[UITextView alloc] initWithFrame:CGRectMake(30, 80, 500, 150)];
detailLabel.tag = 20;
[cell.contentView addSubview:detailLabel];
detailLabel.layer.borderWidth = 1;
detailLabel.layer.borderColor = [[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.9] CGColor];
detailLabel.layer.cornerRadius = 10;
detailLabel.font = [UIFont fontWithName:@"Helvetica" size:17];
[detailLabel release];
}
UITextView * detailLabel = (UITextView *) [cell.contentView viewWithTag:20];
switch (indexPath.row) {
case 0:
detailLabel.text = @"no";
break;
default:
detailLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
detailLabel.hidden = NO;
}