views:

9

answers:

0

I have the following snippet to remove the background from a UISearchBar:

for (UIView *subview in self.searchDisplayController.searchBar.subviews) 
{
    if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) 
    {
        [subview removeFromSuperview];
        break;
    }
}

However, if the device is rotated to landscape a black background appears behind the search bar. Any ideas how to fix it? I'm not exactly sure if this is undocumented.

Thanks!