有关UISearchBar 去除背景。适配IOS6与IOS7
IOS 7 下:
[searchBar setBarTintColor:[UIColor clearColor]];//可用(方法一)
(方法二)在没有提供背景图的情况下的解决方法。
searchBar.backgroundImage = [self imageWithColor:[UIColor clearColor]];- (UIImage *)imageWithColor:(UIColor *)color{ CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image;}

浙公网安备 33010602011771号