分组的UITableView的背景设置问题

在一个UIViewController的viewDidLoad方法中增加一个UITableView,设置其backgroundColor为透明色。

UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style: UITableViewStyleGrouped];//
UITableViewStyleGrouped为分组样式
tableView.dataSource = self;tableView.delegate = self;
tableView.backgroundView = nil;
 tableView.backgroundColor = [UIColor clearColor];[self.view addSubview:tableView];

目前对于这个问题的解决方法是将Group类型的tableView的backgroundView设为一个新的空白View或简单的设置为nil.如下

tableView.backgroundView = [[UIView alloc]init];
tableView.backgroundColor = [UIColor clearColor];

tableView.backgroundView = nil;
tableView.backgroundColor = [UIColor clearColor];
posted @ 2014-01-21 21:58  MrRainQ  阅读(493)  评论(0编辑  收藏  举报