Background image of table cell
- by Shuaib
Hey guys,
Trying to set a background image for a table view cell, tried almost everything but failing. Hoping someone would notice what I am doing wrong. Here is how my current code looks like:
static NSString *CustomCellIdentifier = @"listCustomCell";
listCustomCell *cell = (listCustomCell *)[tableView dequeueReusableCellWithIdentifier: CustomCellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"listCustomCell"
owner:self options:nil];
for (id oneObject in nib) if ([oneObject isKindOfClass:[listCustomCell class]])
cell = (listCustomCell *)oneObject;
}
cell.backgroundColor = [UIColor clearColor];
UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"list_selected.png"]];
//[cell setBackgroundView:backgroundImageView];
cell.backgroundView = backgroundImageView;
The image won't show up in the background of the cell. All I see is plain white background.
Thanks for help.