滚动时 UITableView 单元格变为空白 [英] UITableView cell goes blank when scrolling

查看:22
本文介绍了滚动时 UITableView 单元格变为空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UITableViewController 中设置了单节、单单元格自定义单元格,以显示比屏幕长的视图.但是,在测试时,我注意到在离开视图区域之前向下滚动时,单元格会消失(变为空白).这没什么特别的,但我不明白为什么向下滚动时它会消失,尤其是当它离可视区域还很远的时候.

I have setup a single section, single cell custom cell in a UITableViewController to display a view that was longer than the screen. However when testing I notice the cell will disappear (go blank) when scrolling down before it leaves the view area. It's nothing fancy, but I don't understand why it would would disappear when scrolling down, especially when it is nowhere near leaving the viewable area.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

VendorDetailCell *cell =  [tableView dequeueReusableCellWithIdentifier:@"VendorDetailCell"];
cell.vendorImage.image = [UIImage imageWithData: self.imageData.data];
cell.vendorTitle.text = self.imageData.vendorTitle;
cell.vendorDescription.text = self.imageData.vendorDescription;



   return cell;
}

推荐答案

当表格视图中单元格的框架滚动到表格视图的框架之外时,就会发生这种情况.

This can happen when the frame of the cell in the table view is scrolled so it's outside of the frame of the table view.

  • 你是否实现了tableView:heightForRowAtIndexPath:?

那个高度是单元格的高度吗?

Is that height the height of cell?

将单元格拆分成几个单元格会更好吗在表格视图的某一部分?

Would the cell be better served as being broken up into several cells in one section of the table view?

这篇关于滚动时 UITableView 单元格变为空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆