我正在尝试在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;
}
}
但是仍然没有成功。
UISearchBar
。 - iEngineer