Reputation: 1708
(originally i posted this on Apple Developer Network
and got no response in four days, so i am copy/pasting here)
ARC is enabled.
In my class i have an UITableViewController
property,
@property (nonatomic, strong) UITableViewController* tableViewControllerSectionMenu;
which is used to hold table view for UIPopoverController
.
This code creates UITableViewController
and sets delagate and data source in viewDidLoad:
self.tableViewControllerSectionMenu = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
self.tableViewControllerSectionMenu.tableView.dataSource = self.dataSource;
self.tableViewControllerSectionMenu.tableView.delegate = self;
This works fine until memory warning occur.
After that the table is blank.
I tried putting reloadData
at place where popover is invoked but that changes nothing.
Does somebody know why this is happening and how to remedy this?
By googling i have found several solutions and none have worked in my case.
Upvotes: 1
Views: 748
Reputation: 1708
When memory warning message is received, all views not currently visible on screen are purged. They are supposed to be recreated later when needed.
To recreate them means also to attach delegate and data source again. Since memory warning was received while in ViewController X, and it's view was on screen, my table view got purged.
But as i wasn't moving from X, delegate and data source were not attached again, as that was done in viewDidLoad
.
To evade getting back one step from X, i created a new class for my table view where in viewDidLoad
i attached delegate and data source.
Upvotes: 0
Reputation: 9220
I think your data is cleaned when the memory warning is received. Did you implement either didReceiveMemoryWarning
or viewDidUnload
by any chance?
Upvotes: 1