zoukankan      html  css  js  c++  java
  • ios6,ios7,ios7.1下设置UISearchbar的背景色

    ios系统升级到7.1后,原来在7.0下显示正常的UISearchbar现在又出现问题了。究其原因,是由于UISearchbar的subview又做修改了。

    float version = [[[ UIDevice currentDevice ] systemVersion ] floatValue ];

        if ([ mySearchBar respondsToSelector : @selector (barTintColor)]) {

            float  iosversion7_1 = 7.1 ;

            if (version >= iosversion7_1)

            {

                //iOS7.1

                [[[[ mySearchBar . subviews objectAtIndex : 0 ] subviews ] objectAtIndex : 0 ]removeFromSuperview ];

                [ mySearchBar setBackgroundColor :[ UIColor clearColor ]];

            }

            else

            {

                //iOS7.0

                [ mySearchBar setBarTintColor :[ UIColor clearColor ]];

                [ mySearchBar setBackgroundColor :[ UIColor clearColor ]];

            }

        }

        else

        {

            //iOS7.0 以下

            [[ mySearchBar . subviews objectAtIndex : 0 ] removeFromSuperview ];

            [ mySearchBar setBackgroundColor :[ UIColor clearColor ]];

        }

  • 相关阅读:
    Train Problem(栈的应用)
    Code obfuscatio (翻译!)
    Milking Cows
    Sorting a Three-Valued Sequence(三值排序)
    Asphalting Roads(翻译!)
    FatMouse' Trade
    Fibonacci Again
    Yogurt factory
    经济节约
    Lucky Conversion(找规律)
  • 原文地址:https://www.cnblogs.com/wudan7/p/3739494.html
Copyright © 2011-2022 走看看