zoukankan      html  css  js  c++  java
  • iOS图片设置圆角

     1 + (UIImage *)imageWitCornerRadius:(float)cornerRadius image:(UIImage *)original
     2 {
     3     CGRect frame = CGRectMake(0, 0, original.size.width, original.size.height);
     4     UIGraphicsBeginImageContextWithOptions(original.size, NO, 1.0);
     5     
     6     [[UIBezierPath bezierPathWithRoundedRect:frame cornerRadius:cornerRadius] addClip];
     7     [original drawInRect:frame];
     8     
     9     UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    10     UIGraphicsEndImageContext();
    11     
    12     return image;
    13 }

    //图片压缩

    1 + (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size{
    2     UIGraphicsBeginImageContext(size);
    3     [img drawInRect:CGRectMake(0, 0, size.width, size.height)];
    4     UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    5     UIGraphicsEndImageContext();
    6     return scaledImage;
    7 }
  • 相关阅读:
    WEEK
    更新yum源
    Centos6.9安装Mysql5.7.18
    gitlab使用
    gitlab安装
    git客户端
    服务器端配置
    错误问题
    服务器端
    01找出数组中重复的数
  • 原文地址:https://www.cnblogs.com/kfgcs/p/6387495.html
Copyright © 2011-2022 走看看