iOS开发之修改UISearchBar的背景颜色
【iOS开发之修改UISearchBar的背景颜色】原文链接:http://www.cnblogs.com/Walking-Jin/p/5754519.html
定义方法
/** 取消searchBar背景色 */
- (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size
{
CGRect rect = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
调用
_searchBar.backgroundImage = [self imageWithColor:[UIColor clearColor] size:_searchBar.bounds.size];
推荐阅读
- 永远的梨子
- 从0开始搭建多节点kafka集群
- 女明星泡茶,谁更有范()
- 2.6小番茄种子实践
- 从零开始实现lmax-Disruptor队列(六)Disruptor|从零开始实现lmax-Disruptor队列(六)Disruptor 解决伪共享、消费者优雅停止实现原理解析
- ABAP开发|ABAP 代码中读取会计科目的字段状态(隐藏、可选、必输)
- 我的|我的 iOS 学习小记
- java mysql高校返校新冠疫情排查系统+论文+代码讲解视频+开题报告+所需软件(包远程安装配置)
- 项目开发中Maven的单向依赖-2022新项目
- 银行|赋能实体,开放银行的另一条道路