numberOfRowsInSection no se llama después de reloadData

I've seen various similar posts to this but none seem to match my situtation/solve the problem.

I have a tableview whose delegate and datasource are set to the VC it sits within.

On load this happily calls all the usual methods:

numberOfSectionsInTableView
numberOfRowsInSection
cellForRowAtIndexPath

however at this point the array containing my data is empty.

Once it is populated (after location lookup) [tableView reloadData] is called. This successfully fires:

numberOfSectionsInTableView

but neither of the following are recalled

numberOfRowsInSection
cellForRowAtIndexPath

I have even tried returning different results (0/1) in the numberOfRowsInSection method to try and force it with no result

Gracias por cualquier ayuda

preguntado el 08 de enero de 11 a las 15:01

es el valor de retorno de numberOfSectionsInTableView set to 0? it shouldn't happened not calling -numberOfRowsInSection and other datasource methods. -

no its normally one, so therefore numberOfRowsInSection should always fire at least once -

1 Respuestas

Encontré el error.

The client had been playing with the code and changed the viewForHeaderInSection so that in some cases it was returning nothing (not even nil).

This must have prevented the other methods from firing, despite their being no exception or console log warning.

Respondido el 09 de enero de 11 a las 20:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.