让UISearchBar 的背景消失

阅读更多

还是这段代码处理起来比较简单~~  

 

    for (UIView *view in_searchBar.subviews) {

        // for before iOS7.0

        if ([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {

            [view removeFromSuperview];

            break;

        }

        // for later iOS7.0(include)

        if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count > 0) {

            [[view.subviewsobjectAtIndex:0] removeFromSuperview];

            break;

        }

 

    }

你可能感兴趣的:(让UISearchBar 的背景消失)