Latest 0.0.2
Homepage https://github.com/NEYouFan/ht-imageview-ios
License MIT
Platforms ios 7.0
Dependencies SDWebImage
Authors

HTImageView

网络图片处理控件,封装于SDWebImage,主要增加一些经常使用的交互需求功能封装。
image
特性

  • 提供设置默认图,错误图的统一接口,并且可设置不同模式下的图片的contentMode
  • 提供图片的渐现效果
  • 提供图层的遮罩效果,可设置颜色及圆角信息
  • 提供GIF图的自动播放功能
  • 通过url加载图片

用法

设置图片的默认显示和错误显示方式

[self.imageView setNormalImageContentMode:UIViewContentModeScaleToFill
                           placeHodlerImage:[UIImage imageNamed:@"default.jpg"]
                                contentMode:UIViewContentModeCenter
                                 errorImage:[UIImage imageNamed:@"error.jpg"]
                                contentMode:UIViewContentModeCenter];

设置图片源

[self.imageView setImageWithUrl:[NSURL URLWithString:url] options:0
                         progress:^(NSInteger receivedSize, NSInteger expectedSize) {
                             wself.number.text = [NSString stringWithFormat:@"%lu %%",
                                                  (long)receivedSize*100/expectedSize];

                         } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                             wself.number.text = @"";
                             if (cacheType == SDImageCacheTypeNone){
                                 [wself.imageView setAnimationRepeatCount:20];
                                 [wself.imageView startAnimating];
                             }
                         }];

设置图片渐现

[self.imageView setFadeInAnimationEnable:YES duration:2];

设置图片图层遮罩

[self.imageView setMaskLayerColor:[UIColor greenColor] radius:20];

设置Gif的自动播放及播放次数

[self.imageView setAutoPlay:YES];
[self.imageView setAutoRepeatCount:20];

安装

CocoaPods

  1. pod 'HTImageView' , :git=>'https://g.hz.netease.com/HTIOSUI/HTImageView.git'
  2. pod installpod update
  3. #import "HTImageView.h"

系统要求

该项目最低支持iOS 7.0Xcode 7.0

许可证

HTImageView,详情见LICENSE文件。

Latest podspec

{
    "name": "HTImageView",
    "version": "0.0.2",
    "summary": "u7f51u6613u6807u51c6u5316u63a7u4ef6u5e93u4e4b HTImageView.",
    "description": "A longer description of HTImageView in Markdown format.",
    "homepage": "https://github.com/NEYouFan/ht-imageview-ios",
    "license": "MIT",
    "authors": {
        "netease": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "dependencies": {
        "SDWebImage": [
            "~> 3.7.3"
        ]
    },
    "source": {
        "git": "https://github.com/NEYouFan/ht-imageview-ios.git",
        "tag": "0.0.2"
    },
    "source_files": "HTImageView/*.{h,m}"
}

Pin It on Pinterest

Share This