Hello.
I've seen a number of people having a similar issue, but either their solution did not help, or it was too different.
My problem is, I have a customized UITableViewCell, custom size, image and content. When I scroll up or down and then back again, the text within some of the cells disappears. This seems to be happening randomly.
I have read about the "dequeue"-issue but either I got it wrong or it doesnt fall into my case....
Anyways, heres the code for my Cells:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.imageView.image = [[UIImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:
[[shopItems objectAtIndex:indexPath.row] name] ofType:@"jpg"]];
UITextField *temp= [[UITextField alloc] initWithFrame:cell.frame];
temp.text = [[shopItems objectAtIndex:indexPath.row] name];
temp.textColor = [UIColor whiteColor];
temp.textAlignment = UITextAlignmentCenter;
UIImageView *cellView = [[UIImageView alloc] initWithImage:[[UIImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"smalltabs_wide_bg" ofType:@"png"]]];
[cellView addSubview:temp];
cell.backgroundView = cellView;
return cell;
}
Do you have any(!) ideas on this?