我有一个表格填充了一个可变数组。这些单元格是自定义的,具有在customcellclass上委托的UITextView,我希望保留这个值。它在每个表reloadData之后被擦除。维护自定义单元格中的UITextView的值
有关如何保持它的任何想法?我有这个想法,但不能去:
- 将textView值存储在填充表的同一个数组上。来自哪里? TextViewDidEndEditing?如何传递价值,以及如何知道它是哪一行?
- 维护一个与另一个不同的textViews数组。沟通细胞表的同样的问题,然后我也必须维护这个数组。另外,我应该将textView从.nib中移开。 ...我不知道更多的知道。
任何方法或帮助将不胜感激。谢谢! PS:我做了大量的搜索,大部分指向表单,但这是一个可变数组,我将在表上有未定义的行。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
GuiCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"GuiCustomCell" owner:nil options:nil];
for (UIView *view in views) {
if([view isKindOfClass:[UITableViewCell class]])
{
cell = (GuiCustomCell*)view;
}
}
}
if (timesArray || [timesArray count]) {
TakenTime *time = [[TakenTime alloc] init];
time = [timesArray objectAtIndex:indexPath.row];
if ([timeFormat isEqualToString:@"seconds"]) {
cell.detailTextLabel.text = [time stringTimeFormat2];
} else {
cell.detailTextLabel.text = [time stringTimeFormat1];
}
cell.detailTextLabel.font = [UIFont systemFontOfSize:25];
cell.textLabel.font = [UIFont systemFontOfSize:18];
cell.textLabel.textAlignment = UITextAlignmentLeft;
cell.detailTextLabel.textAlignment = UITextAlignmentCenter;
cell.textLabel.text = [NSString stringWithFormat:@"%i.",indexPath.row+1];
}else{
cell.textLabel.text = @" ";
}
[cell setDefaultText:TRUE];
return cell;
}
对我们的任何代码,看看?就像-cellForRowAtIndexPath:首先。 –
你在编辑中去了!任何你需要的!谢谢 – g10k