UITableView を作成して、多くの設定 UITableViews と同様に、ユーザーがデータを入力できるようにしようとしています。アプリのこのような一般的な機能の場合、これはあまり簡単ではないようです。
カスタム UITableViewCell から indexPath.row にアクセスできません。ここで、カスタム UITableViewCell を割り当てます。
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[TextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
私の TextField クラスの @implementation では、 - (id)initWithStyle: で indexPath にアクセスしようとしています:
NSIndexPath *indexPath = [(UITableView *)self.superview indexPathForCell:self];
... テキストフィールドのタグを次のように設定するには:
textRow = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 21)];
textRow.tag = [indexPath row];
誰でも私の問題に光を当てるか、基本的な設定スタイルのTableViewをプログラムで作成する方向に向けてください。
ありがとうございました