I have small doubt about in checking retain count of the object:
Please find the below code, it is displaying retainCount is 1 after releasing the object memory.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
CGRect contentRect = [cell.contentView bounds];
UIImageView *thumbView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:IMAGE_CELL_BACKGROUND]];
thumbView.frame = contentRect;
cell.backgroundView=thumbView;
[thumbView release];
}
UIImageView *image=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"left_arrow.png"]];
**NSLog(@"Image retain count %d",[image retainCount]);**
image.frame=CGRectMake(290, 12.5, [UIImage imageNamed:@"left_arrow.png"].size.width, [UIImage imageNamed:@"left_arrow.png"].size.height);
image.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:image];
[image release];
**NSLog(@"Image retain count-- after %d",[image retainCount]);**
// Configure the cell...
return cell;
}