iOS7中tableView的backgroundView无法正常工作

6

我正在将一个视图设置为uitableview的背景。这个视图只是具有colorWithPatternImage。

在iOS6中,它可以正常工作,但在iOS7中没有任何效果,UITableView的背景仍然是白色的。我正在使用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 可能出现哪些问题? 求助,谢谢。


哇,你还在使用Three20库吗? - Enrico Susatyo
1个回答

7
在iOS 7中,tableview的单元格自动具有白色背景颜色。您需要清除单元格的颜色和背景。
cell.backgroundColor = [UIColor clearColor];
cell.backgroundView =  [UIView new];

在cellForRowAtIndexPath中使用

这肯定会解决问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接