我见过一些人有类似的问题,但他们的解决方案没有帮助,或者它太不同了。自定义的UITableViewCell消失
我的问题是,我有一个自定义的UITableViewCell,自定义大小,图像和内容。当我向上或向下滚动然后再回来时,某些单元格内的文字消失。这似乎是随机发生的。
我已阅读有关“出列” -issue但无论是我听错了或者它不落入我的情况....
不管怎么说,继承人为我的单元格中的代码:
- (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;
}
你有什么想法吗?
真实的,我忘了将其释放,但现在,我固定的,问题仍然存在。 – Icky 2010-01-12 15:41:52