cellForRowAtIndexPath not being called on tableView reloadData
Posted
by BotskoNet
on Stack Overflow
See other posts from Stack Overflow
or by BotskoNet
Published on 2010-03-12T00:21:24Z
Indexed on
2010/03/12
1:57 UTC
Read the original article
Hit count: 747
iphone
|iphone-sdk
I have a UITableView on one view that loads in data at the start of the application, and then later when a user enters text into a box and hits a button, I re-query the database, re-populate the original NSMutableArray that stores the data for the table.
All of that is working perfectly. In some logging statements I can tell that the array has the correct information, the numberOfRowsInSection method is returning the proper count, and is being called after the reload is called.
However, the cellForRowAtIndexPath is never called the second time (after the reload) and the table data is never updated.
I've spent hours searching the net and I've found nothing that helps. Can anyone help?
All code is at: http://github.com/botskonet/inmyspot
The specific reload is being called at: http://github.com/botskonet/inmyspot/blob/master/Classes/InMySpotViewController.m
Roughly Line 94
From: http://github.com/botskonet/inmyspot/blob/master/Classes/PlateFormViewController.m
Roughly line 101
A bit more info: once the new data has been added to the mutablearray, if I try to start scrolling the table, it eventually dies with:
"Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (29) beyond bounds (29)'"
Which I assume means the table cells can't find any data in the array to match the scroll position, which seems to be because the array has the new data, but the table doesn't.
© Stack Overflow or respective owner