UITableView Drawing Problems When ReloadData Is Called
cocoa-touch, iphone, objective-c, uikit, uitableview
Solution
Will it help if you do a `[ myTable performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]` ?
The problem you mentioned can arise if you do not action your GUI updates from the main thread.
Problem
I have a pretty large list of 'items' (up to 250 entries) which is constantly changing. The list is being displayed in a UITableView. I have a polling thread that will download some new entries and insert them into a SQLite DB. 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. 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. 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.