UIImage+PYJColorBecomeImage.h:

//
// UIImage+PYJColorBecomeImage.h
// 颜色转成图片
//
// Created by PengYunjing on 16/8/24.
// Copyright © 2016年 PYJ. All rights reserved.
// #import <UIKit/UIKit.h> @interface UIImage (PYJColorBecomeImage) + (UIImage*)imageWithColor:(UIColor*)color; @end

UIImage+PYJColorBecomeImage.m:

//
// UIImage+PYJColorBecomeImage.m
// 颜色转成图片
//
// Created by PengYunjing on 16/8/24.
// Copyright © 2016年 PYJ. All rights reserved.
// #import "UIImage+PYJColorBecomeImage.h" @implementation UIImage (PYJColorBecomeImage) + (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 *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
} @end

UIImage+PYJColorBecomeImage的更多相关文章

  1. SDWebImage源码解读 之 UIImage+GIF

    第二篇 前言 本篇是和GIF相关的一个UIImage的分类.主要提供了三个方法: + (UIImage *)sd_animatedGIFNamed:(NSString *)name ----- 根据名 ...

  2. 聊天气泡 button backgroundImage uiimage 拉伸 stretchableImageWithLeftCapWidth: 方法的使用

    - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCap ...

  3. github源码学习之UIImage+YYWebImage

    UIImage+YYWebImage是YYWebImage(https://github.com/ibireme/YYWebImage)中的一个分类,这个分类封装了一些image常用的变化方法,非常值 ...

  4. 第3月30天 UIImage imageWithContentsOfFile卡顿 Can't add self as subview MPMoviePlayerControlle rcrash

    1. UIImage imageWithContentsOfFile卡顿 [[UIImage alloc] initWithContentsOfFile 卡顿 2.uitableview scroll ...

  5. 使用libjpeg.framework压缩UIImage

    +(void)writeFile:(NSString *)filePath withQuality:(int)quality { //初始化图片参数 UIImage *image=[UIImage i ...

  6. iOS开发之功能模块--长方形UIImage截取中间最大正方形区域

    这里直接用CoreGraphics的一些处理图片的方法,本身不难,但是有些时候用的不多,就会遗忘掉使用方法的细节.下面就直接展示关键源码,以便下次重复需求,就可以立马找回. 该方法中在UIImage的 ...

  7. iOS 分析一个支持GIF的UIImage扩展:SwiftGIF

    Github:https://github.com/bahlo/SwiftGif 这个extension代码不多,主要通过Apple的ImageIO框架进行解析GIF. 整个扩展最核心还是下面的函数, ...

  8. UIImage加载本地图片的两种方式

    UIImage加载图片方式一般有两种: (1)imagedNamed初始化:默认加载图片成功后会内存中缓存图片,这个方法用一个指定的名字在系统缓存中查找并返回一个图片对象.如果缓存中没有找到相应的图片 ...

  9. uiimage 上传 数据库

    之前我所接触的上传图片都是直接与服务器交互的,即 app端要做的就是上传到服务器 现在这个项目却是app先上传到"数据库",由"数据库"传到服务端 下面说主题 ...

随机推荐

  1. Chemistry

    Problem A. Chemistry Input file: chemistry.in Output file: chemistry.out Time limit: 1 seconds Memor ...

  2. How to create and manage configuration backups in Internet Information Services 7.0

    https://support.microsoft.com/en-us/help/954872/how-to-create-and-manage-configuration-backups-in-in ...

  3. 自己写的JS排序算法

    这学期刚刚学完数据结构,之前就自己写了一点东西,现在整理一下. <!DOCTYPE html> <html> <head> <meta charset=&qu ...

  4. hdu 5391 Zball in Tina Town 威尔逊定理 数学

    Zball in Tina Town Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Oth ...

  5. TCP中间件_个人方案

    按照功能分类,不管是直接的 insert/delete/update/select语句 还是 调用存储过程,基本的功能 就是 增删改查.又分为两大类: (1).查询(会返回结果集的),(2).非查询( ...

  6. 关于Jupyter Notebook默认起始目录设置无效的解决方法

    一.问题描述 今天折腾jupyter的时候,突然觉得起始目录是用户根目录很麻烦,想着把他改成自己的某个文件,按照网上方法折腾半天也还是无效.东点点西看看才发现端倪. [win10以下好像没这个问题,修 ...

  7. 在数据库中添加数据以后,使用Mybatis进行查询结果为空

    在数据库中添加数据以后,使用Mybatis进行查询结果为空,这是因为数据库中添加数据忘记commit的缘故.

  8. 图片与路径(Path)的应用

    图片的应用:软盘样式的保存按钮,笔记本样式的编辑按钮:只能用图片 路径(Path)的应用:异形轮廓(各种气泡框,普通控件无法描述):异形线条(普通控件无法描述):图片(不建议,因为展现效果不好,比如: ...

  9. C#中的字符串及其编码转换

    (转自:http://blog.sina.com.cn/s/blog_498eab7d0100et7j.html) 根据查找的System.Text.Encoding类的属性,方法写了如下的转换程序: ...

  10. poj1469

    题解: 二分图匹配 然后判断最大匹配是否是m 代码: #include<cstdio> #include<cmath> #include<algorithm> #i ...