gpt4 book ai didi

ios - 带有 UISearchBar 的奇怪行为 UIRefreshControl

转载 作者:可可西里 更新时间:2023-11-01 05:33:59 26 4
gpt4 key购买 nike

我将 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];

enter image description here

enter image description here

问题是上面的白色背景

有什么想法吗?

最佳答案

为表格创建一个背景 View 并将其颜色设置为clearColor,就像这样

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

关于ios - 带有 UISearchBar 的奇怪行为 UIRefreshControl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27512007/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com