开发者

UITableView visible cells not refreshing on ReloadData when changing device orientation

开发者 https://www.devze.com 2023-01-27 10:19 出处:网络
I am trying to get all the cells in my UITableView to call the CellForRowAtIndexPath when I rotate the device. I call a [self.tableView reloadData] in the willRotateToInterfaceOrientation method. This

I am trying to get all the cells in my UITableView to call the CellForRowAtIndexPath when I rotate the device. I call a [self.tableView reloadData] in the willRotateToInterfaceOrientation method. This gets called (i've NSLog-ed it). But when I rotate the device CellForRowAtIndexPath only gets called for new rows that need displaying. But I want to rearrange the UIImageViews in the visible cells as well. However these never get updated.

开发者_StackOverflow社区Can anyone help?

Cheers Nick


WOW GOT IT!!! Just cost me a day of trying stuff. But it is usually something simple like this:

self.tableView only works if the main view is a subclass of UITableViewController. In my case it is not, I dragged the tableView into the XIB.

I need to determine which subview to reload:

//The view might not be at index:0, in my case it is... 
[[self.view.subviews objectAtIndex:0] reloadData];
0

精彩评论

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