美文网首页
根据颜色生成图片

根据颜色生成图片

作者: 闲得一B | 来源:发表于2016-06-21 14:03 被阅读28次
    - (UIImage *)saImageWithSingleColor:(UIColor *)color
    {
        UIGraphicsBeginImageContext(CGSizeMake(1.0f, 1.0f));
        CGContextRef context = UIGraphicsGetCurrentContext();
        CGContextSetFillColorWithColor(context, [color CGColor]);
        CGContextFillRect(context, CGRectMake(0, 0, 1, 1));
        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        
        return image;
    }
    

    相关文章

      网友评论

          本文标题:根据颜色生成图片

          本文链接:https://www.haomeiwen.com/subject/vargdttx.html