更改tableview颜色后,刷新控制器消失

时间:2015-03-29 00:54:45

标签: ios objective-c uitableview

您好我更改了UITableView背景颜色,刷新控制器消失了。

这是更改表格背景的代码:

UIView *bview = [[UIView alloc] init];
bview.backgroundColor = [UIColor blackColor];
[self.tableView setBackgroundView:bview];

enter image description here

这是我拉动刷新时间

enter image description here

 // Initialize the refresh control.
self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.backgroundColor = [UIColor whiteColor];
self.refreshControl.tintColor = [UIColor redColor];
[self.refreshControl addTarget:self
                        action:@selector(retrieveData)
              forControlEvents:UIControlEventValueChanged];
self.tableView.alwaysBounceVertical = YES;

2 个答案:

答案 0 :(得分:0)

不要设置背景视图属性,只需这样做。

// Set table view background color
self.tableView.backgroundColor = [UIColor blackColor];

// Initialize the refresh control
self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.backgroundColor = [UIColor blackColor];
self.refreshControl.tintColor = [UIColor redColor];
[self.refreshControl addTarget:self
                    action:@selector(retrieveData)
          forControlEvents:UIControlEventValueChanged];
self.tableView.alwaysBounceVertical = YES;

答案 1 :(得分:0)

我找到的答案是更改scrollView外观

[[UIScrollView appearance] setBackgroundColor:[UIColor blackColor]];