[英]UITableView background has weird behavior
I have a UIViewController
with a UITableView
, which is showed from the root view controller. 我有一个带有UITableView
的UIViewController
,这是从根视图控制器显示的。 In the simulator everything is working fine, but when testing the app on a real device running iOS7, the background of the UITableView is the same image of the root view. 在模拟器中,一切正常,但是在运行iOS7的真实设备上测试应用程序时,UITableView的背景与根视图的图像相同。
Setting both backgroundColor
and backgroundView
has no effect. 同时设置backgroundColor
和backgroundView
无效。 I have also tried to set tableView.opaque = NO
and setting the background of the cells, but still not results. 我也尝试设置tableView.opaque = NO
并设置单元格的背景,但仍然没有结果。
Any ideas on how to fix this behaviour? 关于如何解决此行为的任何想法?
Try with this piece of code: 尝试这段代码:
contentTable = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain];
contentTable.delegate = self;
contentTable.dataSource = self;
[contentTable setBackgroundView:nil];
[contentTable setBackgroundColor:[UIColor blueColor]]; // i.e. Bluecolor as backgrounf
This will return a table with a blue background. 这将返回带有蓝色背景的表格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.