В вашем методе TableView cellForRowAtIndexpath:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UITextField* textField;
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
textField = [[UITextField alloc] initWithFrame:CGRectMake(10,20,30,30)];
textField.tag = 10;
[[cell contentView] addSubView:textField];
[textField release];
}
else
{
textField = (UITextField *)[cell.contentView viewWithTag:10];
}
// Do something with TextField
return cell;
}
У вас может быть только одна кнопка добавления на панели навигации в правом верхнем углу, которая добавит в NSMutableArray текстовое поле addObject и перезагрузит таблицу.Внутри cellForRowAtIndexPath получите objectAtIndex для этого массива и добавьте в ячейку contentView.Для удаления ячеек вы можете использовать для удаления ячеек ...
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
// If row is deleted, remove it from the Array.
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// delete your data item here
}
}