Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView reloadData does not seem to cause cellForRowAtIndexPath: to be called

I am currently writing an app, using storyboards, that contains two UITableViews within the same window.

When running the application, the first UITableView will populate with a number of "Registration Numbers".

When the user taps on a cell, then the second UITableView is supposed to populate with detail about the selected cell.

When tapping a number in the first table I have a method that drives the:

[mySecondTableView reloadData]

Which it does. I am under the impression that when invoking the reloadData command, it should then call both:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

and

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

The first fires, but the second won't. I have both the data source and delegate wired to self.

I am not sure what I am missing.

Are both methods meant to fire?

like image 210
Fritzables Avatar asked Jul 27 '13 04:07

Fritzables


1 Answers

When things like this happen to me, it's usually because I'm calling -reloadData outside of the main thread.

like image 188
hatfinch Avatar answered Oct 10 '22 22:10

hatfinch