我无法清空搜索栏,尝试通过将其背景颜色设置为透明以及在搜索栏下方放置一张图像来清空它。
我还将搜索栏的背景设置为透明。
for (UIView *subview in self.searchBarHome.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
[subview removeFromSuperview];//please help me to make clear background of uisearchbar
break;
}
}
[self.searchBarHome setBackgroundColor:[UIColor clearColor]];