HELP!.UITableView not reloading data on reloadData() or calling cellForRowAtIndexPath
I am having a serious issue with UITableView reloadData method. I have a UIViewController class, WiGiMainViewController that has a UITableView and NSMuttableArray in it. I am currently issuing network calls in the AppDelegate, and posting notifications to the WiGiMainViewController once the data has been downloaded. In my selector method for the notification, reloadWigiList, I am passing an NSArray containing the the recently downloaded items. I then initialize the WiGiMainViewController's NSMuttableArray with the passed in array and proceed to call reloadData() on my UITableView object. I can see from nslog statements that the numberOfRowsInSection is fired on reload but not the cellForRowAtIndexPath, therefore causing the UI NOT to reload the UITableView with the newly downloaded items. I have verified that the reloadData method is being called on the main thread and that the datasource delegate are set in IB and programatically in the viewDidLoad method of WiGiMainViewController. Any ideas why my UITableView, wigiLists isn't reloading the data, in particular, not calling the cellForRowAtIndexPath method?
EDIT: When the view first loads numberOfRowsInSection is 0. But this should be correct, as at this time the itemlist count is equal to 0, and won't be filled until the items are downloaded. However afterwards, when the data is downloaded the itemList count is equal 6 and upon calling reloadData, the numberOfRowsInSection returns a count of 6. I have noticed that if i put 1 or a number greater than 0 for numberofRows I can see the first item shown on the tableview after I scroll.
EDIT: I am PRETTY sure the delegate and datasource are set correctly in both IB and viewDidLoad(). When reloadData is issued, numberOfRowsInSection is called, but cellForRowAtIndexPath isn't.
Wait a second. Where are the implementations of those methods? All I see is the declarations in the header file, which by the way you don't need to do, that's what conforming to a protocol is for. But I, for example, don't see the cellForRowAtIndexPath implemented anywhere.
Wait a second. Where are the implementations of those methods? All I see is the declarations in the header file, which by the way you don't need to do, that's what conforming to a protocol is for. But I, for example, don't see the cellForRowAtIndexPath implemented anywhere.
I ommited it for brevity. Here it is though, its just being called when the app first starts but then not again.
Wow! after 3 days of banging my head against this problem, it was something ridiculously simple. In my ViewDidLoad method of WiGiMainViewController, i was initializing my tableview:
Because I had linked the tableView I created in IB to my instance wigiLists, alloc'ing and initializing in the ViewDidLoad overwrote my link to the tableView created in IB and currently being displayed. Getting rid of this line fixed everything.