手机
当前位置:查字典教程网 >编程开发 >IOS开发 >IOS开发代码分享之设置UISearchBar的背景颜色
IOS开发代码分享之设置UISearchBar的背景颜色
摘要:今天用到UISearchBar,之前网上提供的方法已经不能有效的去除掉它的背景色了,修改背景色方法如下:mySearchBar.backgr...

今天用到UISearchBar,之前网上提供的方法已经不能有效的去除掉它的背景色了,修改背景色方法如下:

mySearchBar.backgroundColor = RGBACOLOR(249,249,249,1); mySearchBar.backgroundImage = [self imageWithColor:[UIColor clearColor] size:mySearchBar.bounds.size]; //取消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; }

【IOS开发代码分享之设置UISearchBar的背景颜色】相关文章:

iOS开发之视图切换

iOS开发之UITableView与UISearchController实现搜索及上拉加载,下拉刷新实例代码

iOS App开发中使用设计模式中的单例模式的实例解析

详解iOS App开发中UIViewController的loadView方法使用

iOS应用开发中SQLite的初步配置指南

解析iOS应用开发中对设计模式中的抽象工厂模式的实现

iOS开发定时器的三种方法分享

iOS开发实现下载器的基本功能(1)

iOS程序开发中设置UITableView的全屏分隔线的方法(不画线)

IOS开发笔记整理49之详解定位CLLocation

精品推荐
分类导航