Huey
Huey

Reputation: 2834

Dark Corners UITableViewController

I have a UITableViewController. In viewDidLoad, I do the following:

self.tableView.backgroundColor = [UIColor clearColor];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_cafe.png"]];

The background is supposed to be a gradient. Two issues:

  1. Gradient seems to get cut off at the end of the UITableView.
  2. The corners are tinted.

I've experimented with setting the UITableCell's opacity to NO, but that doesn't worked. I have read these threads already: Transparent background in grouped UITableView - iPhone, and Black corners around UITableViewCells.

I'm not using Interface Builder at all for this.

Example:

Example of tinted corners

Upvotes: 0

Views: 192

Answers (1)

Filip Radelic
Filip Radelic

Reputation: 26683

Make a UIView with that pattern image as background color and set it as table view's background view.

UIView *bgView = [[UIView alloc] initWithFrame:self.tableView.frame];
bgView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_cafe.png"]];
self.tableView.backgroundView = bgView;
[bgView release];

Upvotes: 1

Related Questions