Hi there! I have following problem: I've got an UITableView with 7 custom cells. Each of these cells hold a label and an UITextField in it. Since the cells are somewhat big, you have to scroll down to see the last 3 cells. The problem is, as soon as I scroll down, the text in the textfields of the first 3 cells (those, that aren't visible then) gets removed. All that is left is the placeholder. The same goes for the last 3 cells, as soon as I scroll back up. The textfield in the 4th cell retains its text just fine, since its always visible. Does anyone have an idea how to solve this problem?
Best regards.
UPDATE: Here's the code for the corresponding comment:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"NewXYZTableCell";
NewXYZTableCell *cell = (NewXYZTableCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"NewXYZTableCell" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[NewXYZTableCell class]])
{
cell = (NewXYZTableCell *)currentObject;
break;
}
}
}
switch (indexPath.row) {
case 0:
cell.myLabel.text = @"XYZ";
// and so on...
default:
break;
}
return cell;}