iptのmail.appのようにUItableViewにセルを追加したいと思います。私の細胞では、私はUITextFieldsを持っている、と私はフォーカスuitableViewにセルをMail.appのように追加する
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath{
NSLog(@"%d",newIndexPath.row);
UITextField* field = (UITextField *) [tblView viewWithTag: newIndexPath.row];
int l_cellNum = field.tag;
if(l_cellNum == 1 && isAddedNewRow == FALSE){
isAddedNewRow = TRUE;
[cellsArray insertObject:@"CC" atIndex:1];
[cellsArray insertObject:@"BCC" atIndex:2];
CGRect tvbounds = [tblView bounds];
[tblView setBounds:CGRectMake(tvbounds.origin.x,
tvbounds.origin.y,
tvbounds.size.width,
tvbounds.size.height)];
NSIndexPath *path1 = [NSIndexPath indexPathForRow:1 inSection:0];
NSIndexPath *path2 = [NSIndexPath indexPathForRow:2 inSection:0];
NSArray *indexArray = [NSArray arrayWithObjects:path1,path2,nil];
[tblView insertRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationTop];
[tblView reloadRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
}
[field becomeFirstResponder];
}
を設定するには、この方法を変更しましたが、私はセルのいずれかにクリックしたときに、私は(mail.appのような)2つのセルを追加しますが、テキストフィールドのための私のタグが更新をしないでください私はreloaddataメソッドを呼び出すと、この新しいセルを使用して、新しいセルをすべてのセルに渡して呼び出すと、すべてのセルに対して-cellForRowAtIndexPathを呼び出すと、それも機能しません。