简体   繁体   中英

Background image does not extend to accessory view background in table view cell

I'm using the code below to set a background under each cell in my table view. It works fine but there's a white space under the accessory view on the right side so the background does not cover this area. Any idea on how to fix this issue ?

(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
   cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cell-background.png"]];
}

Thx for helping,

Stephane

You probably want to create a custom cell. Please see Apple's documentation about contentView .

To add subviews to a cell to customize it furthur please see this . It also has a section on how to create custom cells from XIBs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM