当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - 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:

网友答案:

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];
分享给朋友:
您可能感兴趣的文章:
随机阅读: