美文网首页
圆角,图片相关

圆角,图片相关

作者: 吖几角 | 来源:发表于2018-02-28 23:50 被阅读17次
    #pragma mark -
    - (UIImage *)resizeImage:(UIImage *)image size:(CGSize)size
    {
        UIGraphicsBeginImageContextWithOptions(size, NO, UIScreen.mainScreen.scale);
        CGRect imageRect = CGRectMake(0.0, 0.0, size.width, size.height);
        [image drawInRect:imageRect];
        UIImage *retImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    
        return retImage;
    }
    
    - (UIImage *)blankImage
    {
        CGSize size = CGSizeMake(25.f, 25.f);
        UIGraphicsBeginImageContextWithOptions(size, YES, 0);
        [[UIColor whiteColor] setFill];
        UIRectFill(CGRectMake(0, 0, size.width, size.height));
        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return image;
    }
    

    相关文章

      网友评论

          本文标题:圆角,图片相关

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