我有一个带有自定义单元格的表格视图。在我的自定义单元格上,我有一个标签和 textView,我想从 textView 获取数据以保存在反馈按钮中。当我在我的数据数组中添加 txtView 时,我得到了两次自定义单元格。如何消除此问题
- (void)textViewDidEndEditing:(UITextView *)textView
{
FeedbackQuestionDC *feedBack = [dataArray objectAtIndex:textView.tag];
feedBack.FeedbackQuestionDC_Answers=textView.text;
[dataArray addObject:feedBack];
[myTableView reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"Feed Back";
feedBackCC *cell = (feedBackCC *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
UIViewController *c = [[UIViewController alloc] initWithNibName:@"feedBackCC" bundle:nil];
cell = (feedBackCC *) c.view;
}
cell.textLabel.font = [UIFont boldSystemFontOfSize:15.0];
FeedbackQuestionDC *feedBack = [dataArray objectAtIndex:[indexPath row]];
cell.lblQuestion.text = feedBack.FeedbackQuestionDC_QuestionText;
cell.txtViewAnswer.tag=indexPath.row;
cell.txtViewAnswer.text=feedBack.FeedbackQuestionDC_Answers;
cell.txtViewAnswer.delegate=self;
return cell;
}