zoukankan      html  css  js  c++  java
  • UIImage+PYJColorBecomeImage

    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
  • 相关阅读:
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    RabbitMQ
    .net 5.0
    redis
    分布式同步服务中间件
  • 原文地址:https://www.cnblogs.com/pengyunjing/p/6036221.html
Copyright © 2011-2022 走看看