views:

43

answers:

1

I'm developing a graphing application that on the main navigation/tab view displays a UIView that renders a graph using openGL. Beneath that view is a UITableView that displays the list of elements on the graph, and an add button.

Occasionally, when the user clicks on another tab, and then returns to the graph view tab, the table view does not get redrawn.

I have a [tableView reloadData] method being called in the navigation controllers' (also the table view's delegate and data source) viewDidAppear method.

numberOfSectionsInTableView and numberOfRowsInSection get called, but cellForRowAtIndexPath does not despite both latter methods returning positive values.

This is an intermittant problem, only happening some of the time, but it's not clear what (if anything) influences this.

Does anyone have any ideas?

[edit] Should just quickly add; clicking or otherwise interacting with the table view, whether faulted as described or not, ALWAYS causes it to be sucessfully redrawn.

[And again] A bit more information; when it faults as described, and calls the first two but not the cellforRowetc method, it seems to wait until the user interacts with the table before cellForRowetc is finally called (the first two methods are then not called) and is redrawn.

A: 

I had a UIActivityIndicator, started on a seperate thread, that showed when requests were being made to a web service. When the web service calls were completed, a notification was sent to the graph controller class to stop and hide the UIActivityIndicator. In this method, reloadData was being called on the table whether the view was visible or not, which seemed to be causing the problem.

The conclusion seems to be not to call reloadData on a table unless it's visible.

Tobster