开发者

UITableView not loading data the second time

I have a UITableView and I call reloadData in the viewWillAppear method

- (void)viewWillAppear:(BOOL)animated {

    [tableView reloadData];
}
开发者_StackOverflow社区

However, the second time my view appears, neither numberOfRowsInSelection nor cellForRowAtIndexPath are called

What could I be doing wrong?


I am seeing the same problem and yes, using a breakpoint I have already confirmed that viewWillAppear is called and reloadData executed - but cellForRowAtIndexPath is never called and the table contains stale data.

New information: I tried creating a new class/nib, this time using a UITableViewController instead of a UIViewController and implementing the delegate & datasource interfaces manually. This works as expected - cellForRowAtIndexPath is called and the table is updated. There must be something else UITableViewController does for me that I need to implement in my version, but I don't know what it is....


Solved! My issue, anyhow. I had wired up the datasource and controller connections, but hadn't connected the tableView outlet in my class to the table in the UI builder. smacks forehead. Mine works now, hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜