iOS 通过设置颜色去除UISearchBar的灰色背景
来源:互联网 发布:淘宝虚假交易怎么清洗, 编辑:程序博客网 时间:2024/04/30 09:41
实现效果前:
实现效果后:
实现代码如下:
@property (weak,nonatomic) IBOutletUISearchBar *searchbar;
通过UIImage* searchBarBg;调用下面的代码
UIImage* searchBarBg = [self GetImageWithColor:[UIColorclearColor]andHeight:32.0f];
[self.searchbarsetBackgroundImage:searchBarBg];
#pragma mark 实现搜索条背景透明化
- (UIImage*) GetImageWithColor:(UIColor*)color andHeight:(CGFloat)height{
CGRect r=CGRectMake(0.0f,0.0f, 1.0f, height);
UIGraphicsBeginImageContext(r.size);
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [colorCGColor]);
CGContextFillRect(context, r);
UIImage *img =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
通过这些便实现了去除UISearchBar的灰色背景 1 0
- iOS 通过设置颜色去除UISearchBar的灰色背景
- 如何去除UISearchBar默认的灰色背景颜色
- UISearchBar去除背景颜色
- iOS去掉UISearchBar的灰色背景框
- 设置UISearchBar的背景颜色
- IOS开发代码分享之设置UISearchBar的背景颜色
- iOS开发问题——UISearchBar背景颜色去除问题
- iOS UISearchBar的背景框颜色适应
- iOS UISearchBar的背景颜色修改
- 去掉UISearchBar的那个灰色背景框,,
- 去掉UISearchBar的那个灰色背景框
- iOS更改UISearchBar里面的UITextField的frame以及去除UISearchBar的背景
- IOS开发之修改UISearchBar的背景颜色
- ios-设置UISearchBar输入框的颜色等属性
- 修改UISearchBar的TextField的背景颜色
- 修改UISearchBar的TextField的背景颜色
- iOS6下修改UISearchBar的输入框背景去除阴影,并设置成iOS7风格
- UISearchBar改变输入框的背景颜色
- Linux Shell 文本处理工具集锦
- 分布式计算漫谈
- iOS 链表
- WebStorm 2016 最新版激活(activation code方式)
- lcd
- iOS 通过设置颜色去除UISearchBar的灰色背景
- CSV操作(导出和导入)
- sockaddr_in , sockaddr , in_addr区别Socket编程函数集(非常有用)
- Androidstudio加载工程很慢解决方案
- iOS插入排序
- iOS编译时报错The run destination John的 iPhone is not valid for Running the scheme 'Test'.
- c#实现将DataTable中的数据导出到DBF文件
- JAVA 泛型 - Class<T>
- 解决安卓调用ffmpeg函数avformat_open_input进行转码出现打不开文件