我已经清除了桌面 View 的背景。现在我创建了一个具有透明背景的 PNG 图像,并将其设置为 tableViewHeader 的 backgroundView。
不知何故,PNG 的透明背景在 tableViewHeader 中变成黑色。有人知道怎么回事吗?
谢谢。
//Header Layout
UIView *headerView =
[[[UIView alloc]
initWithFrame:CGRectMake(0, 0, 300, 70)]
autorelease];
UILabel *headerLabel =
[[[UILabel alloc]
initWithFrame:CGRectMake(10, 10, 300, 40)]
autorelease];
headerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"headerBG.png"]];
headerLabel.text = NSLocalizedString(@"Huidig", @"");
headerLabel.textColor = [UIColor redColor];
headerLabel.shadowColor = [UIColor greenColor];
headerLabel.shadowOffset = CGSizeMake(0, 1);
headerLabel.font = [UIFont boldSystemFontOfSize:22];
headerLabel.backgroundColor = [UIColor clearColor];
[headerView addSubview:headerLabel];
tableView.tableHeaderView = headerView;
最佳答案
你试过吗
[tableView setBackgroundColor:[UIColor clearColor]];
[tableView setBackgroundView:nil];
关于ios - tableView header透明背景变黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8718470/