Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created June 19, 2012 20:27
Show Gist options
  • Save jeksys/2956352 to your computer and use it in GitHub Desktop.
Save jeksys/2956352 to your computer and use it in GitHub Desktop.
UISearchBar custom background
for (id img in searchBar.subviews) {
if ([img isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
[img removeFromSuperview];
}
}
[searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"UI_searchbar.png"] forState:UIControlStateNormal];
searchView.backgroundColor = [UIColor clearColor];
for (UIView *subview in [[searchBar.subviews objectAtIndex:0] subviews]) {
subview.alpha = 0.0;
subview.backgroundColor = [UIColor clearColor];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment