解决页面跳转时,搜索条闪烁的问题

当搜索条为导航条的titleView时,页面跳转会造成闪烁的问题,以下为解决办法,直接附代码:

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

if ([ self.searchBar respondsToSelector : @selector (barTintColor)]) {

float  iosversion7_1 = 7.1 ;

if (version >= iosversion7_1)

{

//iOS7.1

[[[[ self.searchBar.subviews objectAtIndex : 0 ] subviews ] objectAtIndex : 0 ] removeFromSuperview ];

[ self.searchBar setBackgroundColor :[ UIColor clearColor ]];

}

else

{

//iOS7.0

[ self.searchBar setBarTintColor :[ UIColor clearColor ]];

[ self.searchBar setBackgroundColor :[ UIColor clearColor ]];

}

}

else

{

//iOS7.0 以下

[[ self.searchBar.subviews objectAtIndex : 0 ] removeFromSuperview ];

[ self.searchBar setBackgroundColor :[ UIColor clearColor ]];

}

你可能感兴趣的:(解决页面跳转时,搜索条闪烁的问题)