ios - tableView header透明背景变黑色

标签 ios xcode uitableview png

我已经清除了桌面 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/

相关文章:

ios - Itunes Connect 与 Apple Developer

ios - 核心数据警告 : Unrecognized optimized model archive format

ios - 从一个函数引用另一个函数中的常量

ios - 从 Swift 中的另一个 View Controller 访问 TableView 单元格信息

ios - Xcode 5 - iOS - 如何在没有 Storyboard 或 XIB 的情况下在 Xcode 中创建 View Controller 以及如何将其配置为 AppDelegate 作为 Root View

iphone - 我如何使用 NSConditionLock?或 NSCondition

ios - 定义与 Swift 2.0 中的先前值冲突

ios - 静态 TableView 中单元格的内容未显示 SWIFT 3

ios - 如何在 iOS 中从 Nsarray 中搜索?

ios - 从自定义 UITableViewCell 获取数据并返回到 UITableViewController