与UISearchBar的stange行为UIRefreshControl

sge*_*ger 4 uitableview uisearchbar ios uirefreshcontrol

我正在使用UIRefreshControl与UISearchBar当我拉动刷新时我看到uiviewcontroller顶部的白色背景

   UISearchBar *searchBar =
[[UISearchBar alloc] initWithFrame:
 CGRectMake(0, 0, self.tableView.frame.size.width, 44.0)];
searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
self.tableView.tableHeaderView = searchBar;

 _refreshControl = [[UIRefreshControl alloc] init];
[_refreshControl addTarget:self action:@selector(update) forControlEvents:UIControlEventValueChanged];
[self.tableView addSubview:_refreshControl];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

在此输入图像描述

问题是上面的白色背景

有任何想法吗?

Joh*_*hen 5

为表创建一个背景视图,并将其颜色设置为clearColor,如下所示

- (void)viewDidLoad {
    self.tableView.backgroundView = [UIView new];
    self.tableView.backgroundView.backgroundColor = [UIColor clearColor];
}
Run Code Online (Sandbox Code Playgroud)