【发布时间】:2011-02-18 19:29:43
【问题描述】:
我一直尝试设置TableView的backgroundColor都没有成功。
当父视图控制器为UIViewContoller 时,将tableView.backgroundColor 和/或cell.backgroundColor 设置为clearColor 不起作用。
我的 nib 文件结构是
FileOwner
View
UITableView
(注意:我将 TableView 设置为 groupedTable 部分)
第一次尝试,我在代码viewDidLoad中创建了UIView
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, 300)] autorelease;
[view setBackgroundColor:UIColor blueColor]; // color it just to see if it is created at the right place
[self.tableView sendSubViewToBack:view];
它有效,但它隐藏了单元格的内容。我可以看到标题的内容,但看不到单元格内容。 (但是当我更改视图的坐标(0,150,160,300)时,我可以看到单元格的内容,但随后它失去了 tableview 的 backgroundColor。
第二次尝试, 我创建了 imageView
View
ImageView
UITableView
并设置了self.tableView.backgroundColor = [UIColor clearColor];,但没有用。
我用谷歌搜索,但没有得到平静的答案。
【问题讨论】:
-
这个问题有答案吗?
标签: iphone xcode uitableview uiviewcontroller