I have a UIViewController with one UITableView in it. The table view holds a list of favorites that can be changed by other parts of the app. I am using NSNotificationCenter to trigger the table view's reloadData method. The table view has an outlet declared as follows:
@property (strong,nonatomic) IBOutlet UITableView *faveTableView;
and synthesized as follows:
@synthesize faveTableView;
The delegate and datasource properties of the table view are set in the view controller's viewDidLoad as follows:
[self.faveTableView setDataSource:self];
[self.faveTableView setDelegate:self];
The NSNotificationCenter causes the following method to fire:
-(void)reloadNotificationReceived{
[self loadData];
[self.faveTableView reloadData];
}
loadData updates the data source which is NSMutableArray of managed objects and is working as it should.
When the view controller loads, cellForRowAtIndexPath is fired as it should be. However, when the notification is received, reloadNotificationReceived is fired and two of the table view delegate methods (numberOfRowsInSection and numberOfSectionsInTableView) ARE fired. However, cellForRowAtIndexPath is NOT fired. numberOfRowsInSection IS returning the correct number of items.
Can anyone offer up a reason why cellForRowAtIndexPath does not get fired here? Thanks!
numberOfSectionsInTableView:returns one, andnumberOfRowsInSection:returns zero? - Sergey Kalinichenko