How to change uitableview cell background image?
I write this code, it’s not working. but I am sure this code some minor mistake.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[cell setBackgroundView:[UIImage imageNamed:@"selected-bg.png"]];
}
You need to wrap the
UIImagein aUIImageViewbefore you can set it as abackgroundView: