У меня есть UITextField
объекта в привышных UITableViewCell
и NSMutablearray
(choicesArray), как следующие коды:UITextField в привышных TableViewCell
- (void)viewDidLoad {
[super viewDidLoad];
self.choicesArray = [NSMutableArray new];
[self.choicesArray addObject:[NSString stringWithFormat:@"123"]];
[self.choicesArray addObject:[NSString stringWithFormat:@"123"]];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.choicesArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
AddChoiceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"choiceCell" forIndexPath:indexPath];
NSString *string = [self.choicesArray objectAtIndex:indexPath.row];
cell.choiceTextField.text = string;
return cell;
}
Когда я вхожу другой текст UITextField
, я хочу, чтобы изменить объект выбор массива.
Что я могу сделать?
это очень плохая идея поставить в текстовое поле ** UITableView ** потому что когда вы прокручиваете ячейку, будет повторно использоваться каждый раз и, возможно, потерянные данные в текстовом поле –
См. [этот ответ] (http://stackoverflow.com/a/27743391/3985749) на очень похожий вопрос. – pbasdf