Latest 0.0.1
Homepage https://github.com/nhfc99/NHFUIImage
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, CoreGraphics, UIKit
Authors

介绍

对UIImage的一个扩展,可以对图片进行压缩、通过颜色来拿到图片、计算图片的等比例缩放、裁剪图片等

安装

  • pod ‘NHFUIImage’
  • 手动下载然后将文件夹拖至工程中即可

使用方法

+(CGFloat)calculateHeightWithWidth:(CGFloat)width resourceSize:(CGSize)size;

+(CGFloat)calculateWidthWithHeight:(CGFloat)height resourceSize:(CGSize)size;

/**

  • 缩放图片
  • @param image
  • @param size
  • @return
    */

    • (UIImage)OriginImage:(UIImage )image
      scaleToSize:(CGSize)size;

/**

  • 压缩图片
  • @param image
  • @param thumbSize
  • @param percent
  • @return
    */

    • (UIImage)createThumbImage:(UIImage )image
      size:(CGSize )thumbSize
      percent:(float)percent;

/**

  • 截取图片中间部分
  • @param image
  • @param thumbSize
  • @param percent
  • @return
    /
    +(UIImage
    )createCentreImage:(UIImage *)image
    size:(CGSize )size
    percent:(float)percent;

/**

  • 进行按比例进行缩比例图片的大小
  • @param resourceImageSize
  • @param toBigSize
  • @return
    */

    • (CGSize)calculateImageSizeWithResourceImageSize:(CGSize)resourceImageSize
      toBigSize:(CGSize)toBigSize;

/**

  • 用于配置SearchBar的背景色
  • @param color
  • @param size
  • @return
    */

    • (UIImage )imageWithColor:(UIColor )color size:(CGSize)size;

/**

  • 压缩图片
  • @param image
  • @param maxFileSize
  • @return
    */

    • (UIImage )compressImage:(UIImage )image toMaxFileSize:(NSInteger)maxFileSize;

/**

  • 通过颜色来得到图片
  • @param color
  • @return
    /
    +(UIImage
    ) imageWithColor:(UIColor*)color;

Latest podspec

{
    "name": "NHFUIImage",
    "version": "0.0.1",
    "summary": "u5bf9UIImageu7684u4e00u4e2au6269u5c55uff0cu53efu4ee5u5bf9u56feu7247u8fdbu884cu538bu7f29u3001u901au8fc7u989cu8272u6765u62ffu5230u56feu7247u3001u8ba1u7b97u56feu7247u7684u7b49u6bd4u4f8bu7f29u653eu3001u88c1u526au56feu7247u7b49",
    "homepage": "https://github.com/nhfc99/NHFUIImage",
    "license": "MIT",
    "authors": {
        "u725bu5b8fu98de": "[email protected]"
    },
    "source": {
        "git": "https://github.com/nhfc99/NHFUIImage.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "UIImage+Unit/*.{h,m}",
    "frameworks": [
        "Foundation",
        "CoreGraphics",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This