Я установил UITextField в UITableViewCell. Загрузите UITableView согласно счетчику массива. Все текстовые поля доступны для редактирования. Но я хочу, чтобы при редактировании UITextField данные UITextField сохранялись в предопределенную NSString. Для каждого текстового поля IndexPath.row используется отдельная строка.
Прикрепляю свой код, который я использовал для создания NSMutableArray...
[arrProfile removeAllObjects];
arrProfile = [[NSMutableArray alloc] initWithObjects:
@{@"title": @"CUSTOMER NAME", @"details": strFName},
@{@"title": @"EMAIL ID", @"details": strEmail},
@{@"title": @"MOBILE NO.", @"details": strContact},
@{@"title": @"STATE", @"details": strStateName},
@{@"title": @"CITY", @"details": @""},
nil];
[_tblProfile reloadData];
Теперь прикрепляем код, используемый в cellForRowAtIndexPath...
static NSString *cellIdentifier = @"cellProfile";
NSDictionary *dictProfile = [arrProfile objectAtIndex:indexPath.row];
ProfileTableViewCell *cell = (ProfileTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
cell.lblTitle.text = [dictProfile objectForKey:@"title"];
cell.txtDetails.text = [dictProfile objectForKey:@"details"];
cell.txtDetails.delegate = self;
[self textFieldShouldReturn:cell.txtDetails];
[self textFieldShouldBeginEditing:cell.txtDetails];
return cell;
Подробнее здесь: https://stackoverflow.com/questions/500 ... leviewcell