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

float version = [[[UIDevicecurrentDevice] systemVersion] floatValue];

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

        float iosversion7_1 = 7.1;

        if (version >= iosversion7_1)

        {

            //iOS7.1

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

            [mySearchBarsetBackgroundColor:[UIColor clearColor]];

        }

        else

        {

            //iOS7.0

            [mySearchBarsetBarTintColor:[UIColorclearColor]];

            [mySearchBarsetBackgroundColor:[UIColor clearColor]];

        }

    }

    else

    {

        //iOS7.0以下

        [[mySearchBar.subviewsobjectAtIndex:0] removeFromSuperview];

        [mySearchBarsetBackgroundColor:[UIColor clearColor]];

    }

相关文章:

  • 2022-12-23
  • 2022-02-13
  • 2021-07-02
  • 2022-12-23
  • 2021-06-24
  • 2022-02-07
  • 2021-09-03
  • 2022-01-20
猜你喜欢
  • 2022-01-03
  • 2022-12-23
  • 2022-01-12
  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-03-31
相关资源
相似解决方案