views:

130

answers:

0

Hello everyone.

I've searched for some time already so I ask my question.

I want to display data in a UITableView. each content of each cell of this tableview is set in an object specially created for this purpose (cellPlainObject).

a cellPlainObject contains many strings, images and so on ... theses cellPlainObject are storred in a NSMutableDictionary

I save theses objects thanks to

 -(void)encodeWithCoder{}
-(id)initWithCoder:(NSCoder *)decoder {}

and

NSData          *data = [[NSUserDefaults standardUserDefaults] objectForKey:CellKey];
NSMutableDictionary *cells = [NSKeyedUnarchiver unarchiveObjectWithData:data];

It works so no problem here, but I try to be clear and understandable.

the problem is actually when I load my UITableViewCell with the content from my cellPlainObject I have a memory leak and I don't know how to patch this. The leak is not on the UITableViewCell objects, I only have the number of displayed cell allocated but a number of NSMutableDictionary quite impressive.

so here comes my question. How to retrieve the content without a leak ?

here is my actual obj-c code :

NSArray     *allKeys    = [displayedCells allKeys];
cellPlainObject     *aCell  = [displayedCells objectForKey:[allKeys objectAtIndex:indexPath.row]] ;

UILabel *label;

// Set the URL.
label = (UILabel *)[cell viewWithTag:URL_TAG];
label.text = aCell._absoluteUrlString;

Many thanks in advance for your help