I have created a custom UITableViewCell with three UILabel and one UIImageView , 1:I created sub class of UITableViewCell , 2:Added the Three Labels and one UIImageView , also in the xib file 3:Creating the cell using following way in cellForRowAtIndexpath
static NSString *CellIdentifier = @"NarrativeCell";
NarrativeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
NSLog(@"New Cell Made");
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"NarrativeCell" owner:nil options:nil];
for(id currentObject in topLevelObjects)
{
if([currentObject isKindOfClass:[NarrativeCell class]])
{
cell = (NarrativeCell *)currentObject;
break;
}
}
}
Narrative n=(Narrative*)[tableArray objectAtIndexPath:indexpath.row];
[cell.articleName setText:n.title];
NSData *data=[[NSData alloc]initWithContentsOfFile:n.file]
[cell.sideImageView setImage:[UIImage imageWithData:data]];
problem is this , its always created new cell and i am getting memory warning and crash after adding few images . please help how can reuse the cell in above code so that it should not use much memory