searchBar去背景色

    if ([ _searchBar respondsToSelector: @selector (barTintColor)]) {
        
        float  iosversion7_1 = 7.1 ;
        if (IOS_VERSION >= iosversion7_1)
        {
            //iOS7.1
            [[[[_searchBar . subviews objectAtIndex : 0 ] subviews ] objectAtIndex : 0 ] removeFromSuperview];
            [_searchBar setBackgroundColor :[ UIColor clearColor ]];
        }
        else
        {
            //iOS7.0
            [_searchBar setBarTintColor:[UIColor clearColor]];
            [_searchBar setBackgroundColor:[UIColor clearColor]];
        }
        
    }
    else
    {
        //iOS7.0 以下
        [[ _searchBar.subviews objectAtIndex : 0] removeFromSuperview ];
        [ _searchBar setBackgroundColor :[UIColor clearColor]];
    }


猜你喜欢

转载自lizhuang.iteye.com/blog/2102340