我正在尝试在iOS 7中删除UISearchBar的边框。在iOS 6中,它工作正常。我以编程方式创建了UISearchBar。我尝试了Stack Overflow和Google的几乎所有产品。
SearchBar现在看起来
我想实现的目标
我尝试了下面提到的所有这些东西
searchBar.layer.borderWidth = 1;
searchBar.layer.borderColor = [[UIColor whiteColor] CGColor];
和
for (id img in searchBar.subviews)
{
if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
{
[img removeFromSuperview];
}
}
和
for (UIView *sub in self.tableView.tableHeaderView.subviews) {
if ([sub isKindOfClass:[UIImageView class]]) {
sub.hidden = YES;
}
}
但仍然没有成功。
我找到了解决办法:设置barTintColor
的UISearchBar
,以clearColor
topSearchBar.barTintColor = [UIColor clearColor];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句