У меня есть UITableView с двумя разными текстовыми полями для ввода текста. Есть ли способ циклически просмотреть весь файл таблицы и сохранить его в основных данных или скопировать результаты в массив, а затем сохранить его в основных данных. Вот код, чтобы создать свои Tableview клеткиСохранение данных из uitableview в основные данные
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Add Terms to New Set";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
questionTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 250, 30)];
questionTextField.adjustsFontSizeToFitWidth = YES;
questionTextField.textColor = [UIColor blackColor];
//questionTextField.placeholder = @"Put Question Here";
questionTextField.keyboardType = UIKeyboardTypeDefault;
questionTextField.returnKeyType = UIReturnKeyDone;
[questionTextField.layer setBorderColor: [[UIColor grayColor] CGColor]];
[questionTextField.layer setBorderWidth: 0.5];
[questionTextField.layer setCornerRadius:8.0f];
[questionTextField.layer setMasksToBounds:YES];
[questionTextField setEnabled: YES];
answerTextField = [[UITextField alloc] initWithFrame:CGRectMake(400, 10, 250, 30)];
answerTextField.adjustsFontSizeToFitWidth = YES;
answerTextField.textColor = [UIColor blackColor];
//answerTextField.placeholder = @"Put Answer Here";
answerTextField.keyboardType = UIKeyboardTypeDefault;
answerTextField.returnKeyType = UIReturnKeyDone;
[answerTextField.layer setBorderColor: [[UIColor grayColor] CGColor]];
[answerTextField.layer setBorderWidth: 0.5];
[answerTextField.layer setCornerRadius:8.0f];
[answerTextField.layer setMasksToBounds:YES];
[answerTextField setEnabled: YES];
[cell addSubview:questionTextField];
[cell addSubview:answerTextField];
return cell;
}
Как I цикл через Tableview и добавить текст вопроса и текст ответа на массив или сохранить прямо в моих основных данных модальных?
Спасибо!