PDA

View Full Version : Images on Custom UITabelCellViews




zerocustom1989
Jul 15, 2010, 04:32 PM
I'm unsure how to implement this properly in my code.

All of my table cells when they dont have images dont cause leaks, but with images on them leaks get shot out everywhere.

I add the images to the cells via interface builder and since they're static images I dont bother to declare them as an IBoutlet or set their properties etc.

I use the following code to set the cell:


static NSString *semesterCellIdentifier = @"SemesterCellIdentifier";

SemesterTableViewCell *semesterCell = (SemesterTableViewCell *)[tableView dequeueReusableCellWithIdentifier:semesterCellIdentifier];
if(semesterCell == nil){
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SemesterTableViewCell" owner:self options:nil];
for(id oneObject in nib)
if([oneObject isKindOfClass:[SemesterTableViewCell class]])
semesterCell = (SemesterTableViewCell *)oneObject;
}
//configure the cell.
[self configureCell:semesterCell atIndexPath:indexPath];
return semesterCell;


Have I dont something wrong in handling the images? Should IB take care of it cause they're static and just inside the .xib?