UITableView自定义单元格滚动后消失的内容 [英] UITableView Custom Cells Disappearing content after Scrolling
本文介绍了UITableView自定义单元格滚动后消失的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看过很多次这里被问到这个问题,但没有一个解决方案适合我。这是我的代码片段:
I have seen this being asked here many times but none of the solutions worked for me. Here is my code snippet:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellClassName = @"DemoTableViewCell_sched";
DemoTableViewCell_sched *cell = [tableView dequeueReusableCellWithIdentifier:CellClassName];
if (cell == nil)
{
NSArray *topLevelItems = [cellLoader instantiateWithOwner:self options:nil];
cell = [topLevelItems objectAtIndex:0];
}
cell.fooData = [self.bugs objectAtIndex:indexPath.row];
return cell;
}
然后我在 ViewDidLoad
cellLoader = [UINib nibWithNibName:@"DemoTableViewCell_sched" bundle:[NSBundle mainBundle]];
推荐答案
当问题解决时,问题就消失了:
The problem went away when either:
-
表格视图包含多个单元格(10 +),
The table view contains many cells (10+),
每个单元格的高度都超过50。
Each cell has a height of more than 50.
很奇怪。
这篇关于UITableView自定义单元格滚动后消失的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文