iOS-去掉UISearchBar背景

iOS系统去掉UISearchBar背景。

// IOS 7
if ([self.searchBar respondsToSelector:@selector(barTintColor)]) {
    [self.searchBar setBarTintColor:[UIColor whiteColor]];
}
// IOS 6
else{
    for (UIView *subview in self.searchBar.subviews) {
        if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
            [subview removeFromSuperview];
            break;
        }
    }
}