I have a TableViewController
inside a PageViewController
, pushed into a NavigationController
. When I tap Back to unload the PageViewController
I see the PageViewController
deallocated, then the TableViewController
deallocated, but not the TableView
cells.
I've made the TableViewCell
as simple as possible...
#import "MyTableViewCell.h"
@implementation MyTableViewCell
- (void)awakeFromNib {
NSLog(@"Created");
}
- (void)dealloc
{
NSLog(@"DEALLOCed");
}
@end
...but still only see the Created message for the TableViewCell
.
And this is how I load my cells...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"EmptyCell";
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (!cell) {
cell = [[MyTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
return cell;
}
Any ideas what may be causing the TableView
cells to stay in memory? And am I right in assuming the TableViewController
and PageViewController
can't be the problem if the dealloc
methods are calling on them?