Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The backgroundView is not a normal view, there's something going on behind the scenes. Check this link out:</p> <p><a href="https://stackoverflow.com/questions/4939517/difference-between-background-view-and-content-view-in-uitableviewcell">Difference between background view and content view in uitableviewcell</a></p> <p>Specifically, from the documentation:</p> <p>backgroundView: The default is nil for cells in plain-style tables (UITableViewStylePlain) and non-nil for grouped-style tables UITableViewStyleGrouped). UITableViewCell adds the background view as a subview behind all other views and uses its current frame location.</p> <p>Hence: it doesn't really have a frame location, it uses the cell's frame location.</p> <p>This code worked:</p> <pre><code>UIImageView *bgView = [[UIImageView alloc] init]; // Creating a view for the background...this seems to be required. bgView.backgroundColor = [UIColor redColor]; cell.backgroundView = bgView; UIImageView *bgImageView = [[UIImageView alloc] init]; // Creating a subview for the background... bgImageView.backgroundColor = [UIColor colorWithWhite:1 alpha:1]; [bgImageView setFrame:CGRectInset(cell.bounds, 1, 1)]; [cell.backgroundView addSubview:bgImageView]; // Assigning the subview, and cleanup. [bgImageView release]; [bgView release]; </code></pre> <p>Spent about an hour trying to figure this out...but it works. This is code in the cellForRowAtIndexPath delegate method--I won't cover the whole thing here obviously.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload