uitableview - tableView backgroundView 在 iOS7 中不起作用

标签 uitableview ios7

我正在设置一个 View 作为 uitableview 的背景。 View 只有 colorWithPatternImage。

它在 iOS6 中工作正常,但在 iOS7 中,它没有任何效果,TableView 背景在 iOS7 中仍然只是白色。我正在使用 Three20 库。

我的代码是

UIImage *imgBackGround = [UIImage imageNamed: @"my_background.png"];
self.tableView.backgroundColor = [UIColor clearColor];

UIView *backView = [[UIView alloc] initWithFrame:self.view.frame];
[backView setBackgroundColor:[UIColor colorWithPatternImage:imgBackGround]];
self.tableView.backgroundView = backView;
[backView release];
self.view.backgroundColor=[UIColor colorWithPatternImage:imgBackGround];

iOS7 会出现什么问题?
请帮助,提前致谢。

最佳答案

在 iOS 7 中,tableview 单元格自动具有白色背景色。您需要清除单元格的颜色和背景。

cell.backgroundColor = [UIColor clearColor];
cell.backgroundView =  [UIView new];
在 cellForRowAtIndexPath 中使用
这肯定会解决它。

关于uitableview - tableView backgroundView 在 iOS7 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19268384/

相关文章:

ios - 如何在 iOS 中设置删除图标而不是删除文本以编辑表格 View 模式?

iOS 如何修复自定义 UITableView 单元格中的 UIButton 高度

swift - 尝试从 Firebase 检索数据时未调用 tableView(_ tableView : UITableView, cellForRowAt indexPath: IndexPath) 函数

javascript - iOS 7 中的跨域 cookie

ios - 如何为 subview Controller 设置 topLayoutGuide 位置

ios - 如何从 DetailViewController 重新加载 MasterView Controller TableView

iOS7 UIScrollView contentInset 不工作

swift - 使用数据源遍历每个 tableView 单元格

swift - 关闭 tableviewcontroller 中 uitableviewcell 中文本字段的键盘 - Swift

ios - 从 IOS 中的 UItableView 中的自定义单元格继续