zoukankan      html  css  js  c++  java
  • 更改UISearchBar系统背景色方法

    1、

    searchBar.searchBarStyle = UISearchBarStyleMinimal;

    2、 

     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;

    }

  • 相关阅读:
    Cpp -- static变量不属于类的实例
    单例模式
    WebView android
    网络编程之一
    初涉json
    初涉XML
    关于JSON的GSON
    网络编程(一)
    硬件51
    重拾C之数据
  • 原文地址:https://www.cnblogs.com/angongIT/p/4409843.html
Copyright © 2011-2022 走看看