当我为我的UITableView
设置backgroundColor
时,它在iPhone (设备和模拟器)上工作得很好,但在iPad模拟器上却不行。相反,对于我设置的任何颜色,我都会得到一个浅灰色的背景,包括groupTableViewBackgroundColor
。
重现步骤:
<
谢谢你的帮忙!
发布于 2010-04-22 11:52:09
试试这个吧。
[myTableView setBackgroundView:nil];
[myTableView setBackgroundView:[[[UIView alloc] init] autorelease]];
发布于 2010-06-15 23:13:17
非常感谢你的这个解决方案。我在UIViewController中使用IBOutlet对UITableView属性应用了这一点,它的工作原理类似于:
[panelTable setBackgroundView:nil];
[panelTable setBackgroundView:[[[UIView alloc] init] autorelease]];
[panelTable setBackgroundColor:UIColor.clearColor]; // Make the table view transparent
发布于 2012-04-20 18:37:57
在iPad上,backgroundView
属性似乎用于为分组的表创建灰色背景色。因此,要在iPad上更改分组表格的背景色,应该nil
出backgroundView
属性,然后在所需的表视图上设置backgroundColor
。
- (void)viewDidLoad
{
[super viewDidLoad];
// If you need to support iOS < 3.2, check for the availability of the
// backgroundView property.
if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) {
self.tableView.backgroundView = nil;
}
self.tableView.backgroundColor = [UIColor whiteColor];
}
https://stackoverflow.com/questions/2688007
复制相似问题