我的问题已在标题中指明:我想摆脱底部绘制的黑线UISearchBar.有任何想法吗?
这是我的意思的图像:

更新:
我认为线是部分UITableView的tableHeaderView.我仍然不知道如何删除它.
很长一段时间以来,我一直试图在我的UISearchBar上面删除一条有害的线路.它在浅色背景上显得较暗或在深色背景上显示为浅色:

我看了这个问题,但它与分隔符或拉动刷新无关.当我最终决定放弃并寻求帮助时,我又开始四处寻找并发现了一个非常简单(虽然可能并非完全直观)的解决方案,所以我想我会分享它以防其他人面临同样的问题.我按如下方式配置搜索栏:
// I tried this drawing method
[self.searchBar setBackgroundImage:[[UIImage imageNamed:@"linen_bg_bar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]];
// and this one.
[self.searchBar setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"linen_bg_bar.png"]]];
// Same problem either way.
[self.searchBar setPlaceholder:NSLocalizedString(@"Filter", @"placeholder text in the search bar")];
[self.searchBar setSearchFieldBackgroundImage:[[UIImage imageNamed:@"linen_textfield_search.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(16, 16, 16, 16)] forState:UIControlStateNormal];
[self.searchBar setImage:[UIImage imageNamed:@"linen_icon_search.png"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
self.table.tableHeaderView = self.searchBar;
[self.table setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"linen_bg_dark.png"]]];
Run Code Online (Sandbox Code Playgroud)
根据这篇文章的建议,我尝试在它上面绘图,但似乎绘图仍然在线下面渲染.
CGRect rect = self.searchBar.frame;
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, 2)];
lineView.backgroundColor = [UIColor redColor]; …Run Code Online (Sandbox Code Playgroud)