zoukankan      html  css  js  c++  java
  • 根据颜色获取图片

    + (UIImage *)imageWithColor:(UIColor *)color{
        // 描述矩形
        CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
        // 开启位图上下文
        UIGraphicsBeginImageContext(rect.size);
        // 获取位图上下文
        CGContextRef context = UIGraphicsGetCurrentContext();
        // 使用color演示填充上下文
        CGContextSetFillColorWithColor(context, [color CGColor]);
        // 渲染上下文
        CGContextFillRect(context, rect);
        // 从上下文中获取图片
        UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
        // 结束上下文
        UIGraphicsEndImageContext();
        
        return theImage;
    }
    

    //设置tabBar的文字颜色  

    self.tabBar.tintColor = [UIColor colorWithRed:254/255.0 green:202/255.0 blue:11/255.0 alpha:1];

     

     

  • 相关阅读:
    NYOJ题目22 素数求和
    最大连续子序列&&MAX SUM
    Computer Transformation
    #转 二分查找
    吃巧克力
    公司年会
    亲和串
    开门人和关门人
    找新朋友
    big number
  • 原文地址:https://www.cnblogs.com/pengsi/p/5478400.html
Copyright © 2011-2022 走看看