调用ReloadData时UITableView绘图问题 [英] UITableView Drawing Problems When ReloadData Is Called

查看:180
本文介绍了调用ReloadData时UITableView绘图问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常大的'items'(最多250个条目)列表,这是不断变化的。该列表显示在UITableView中。

I have a pretty large list of 'items' (up to 250 entries) which is constantly changing. The list is being displayed in a UITableView.

我有一个轮询线程,将下载一些新条目并将它们插入SQLite DB。

I have a polling thread that will download some new entries and insert them into a SQLite DB.

当新条目到达时,我调用我的表视图数据源对象来更新其数据集,它运行SQL查询并返回一个新的条目数组。

When new entries have arrived, I call to my table view data source object to update its data set, which runs a SQL query and returns a new array of entries.

完成后,我在表视图上调用-reloadData。当发生这种情况时,在大约7种情况中,表视图绘制为空白(不显示单元格,只有表的背景颜色可见),直到进行后续的-reloadData调用。触摸表格视图(滚动,选择单元格,任何会强制重绘的任何内容)将使其重新显示。

After this is complete, I call -reloadData on the table view. When this happens, in about 7 out of 10 cases, the table view draws blank (no cells are displayed and only the background colour of the table is visible) until a subsequent -reloadData call is made. Touching the table view (scrolling, selecting a cell, anything that will force a redraw) will make it reappear.

表视图及其IBOutlet指针及其当前显示的单元格在我看到空白绘图错误的时候都是有效的,所以我相信他们没有被释放。

The table view, its IBOutlet pointer and it's currently displayed cells are all valid at the times I see the blank drawing bug, so I'm fairly confident that they're not being released.

我一直在试图调试这个现在几天了,它真的开始把我推到了墙上。

I've been trying to debug this for a few days now and it's really beginning to drive me up the wall.

任何帮助将是惊人的真棒,谢谢。

Any help on this would be freaking awesome, thanks.

推荐答案

$ c>?

如果您不从主线程处理您的GUI更新,可能会出现您提到的问题。

The problem you mentioned can arise if you do not action your GUI updates from the main thread.

这篇关于调用ReloadData时UITableView绘图问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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