在iphone中滚动期间重复tableview单元格的问题 [英] Repeat Problem of tableview cell during scrolling in iphone

查看:102
本文介绍了在iphone中滚动期间重复tableview单元格的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有5个细胞,每个细胞都有一个动态标签。使用heightForRowAtIndexPath方法将单元格的高度定义为每个标签内容。现在,正在显示3个单元格。当我滚动下一个单元格然后调用cellForRowAtIndexPath一次并且在输出中任何一个(4 OR 5)单元格正确显示但另一个单元格具有第一个单元格内容(重复)。
有没有解决方法可以解决这个问题?应该调用cellForRowAtIndexPath方法2次。
我已经正确定义了部分和行。

There are 5 cells and each cell has one dynamic label. the height of cell is defined as per label content using heightForRowAtIndexPath method. Now, 3 cells are being displayed. When I scroll for next cells then cellForRowAtIndexPath is called once and In the output any one (4 OR 5) cell is displayed correctly but another has 1st cell content(repeating). Is there any solution to fix this? cellForRowAtIndexPath method should be called 2 times. I have defined sections and rows correctly.

推荐答案

删除判断

if(cell == nil)

if (cell == nil)

那很好。我现在解决了我的问题。非常感谢你。

That's good.I solve my problem now.Thank you very much.

这篇关于在iphone中滚动期间重复tableview单元格的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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