セルの内容を直接編集することはできません。コンテンツを編集する必要がある場合は、サブビューとしてUITextField
またはセルに追加します。UITextView
そしてそれらにアクセスします。
編集:以下のようにテキストフィールドを追加できます:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"cellIdentifier";
UITableViewCell *cell;
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
// ADD YOUR TEXTFIELD HERE
UITextField *yourTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 5, 330.0f, 30)];
[yourTf setBackgroundColor:[UIColor clearColor]];
yourTf.tag = 1;
yourTf.font = [UIFont fontWithName:@"Helvetica" size:15];
yourTf.textColor = [UIColor colorWithRed:61.0f/255.0f green:61.0f/255.0f blue:61.0f/255.0f alpha:1.0f];
yourTf.delegate = self;
[cell addSubview:yourTf];
}
// ACCESS YOUR TEXTFIELD BY REUSING IT
[(UITextField *)[cell viewWithTag:1] setText:@"YOUR TEXT"];
return cell;
}
UITextField デリゲートを実装すると、この UITextField を使用してセルの内容を編集できます。
お役に立てば幸いです。