DXPhotoBrowser 0.1.4

DXPhotoBrowser 0.1.4

测试已测试
Lang语言 Obj-CObjective C
许可 MIT
发布最后发布2015 年 9 月

David Tse 维护。



  • xiekw2010

另一个显示图片的图片浏览器。

示例

demoImage

奖励

  1. 可能是最容易使用的 API。
  2. 从某个视图动画扩展和收缩。
  3. 支持手势关闭。
  4. 当向右拉到尽头时,如果实现了代理,将触发一些事件。

API

_simplePhotoBrowser = [[DXPhotoBrowser alloc] initWithPhotosArray:@[ id<DXPhoto> ]];
[_simplePhotoBrowser showPhotoAtIndex:someIndexWithThePhotos withThumbnailImageView:someImageViewOrNil];

与 SDWebImage 集成

id<DXPhoto> 必须的协议方法 loadImageWithProgressBlock:completionBlock: 可以实现如下

- (void)loadImageWithProgressBlock:(DXPhotoProgressBlock)progressBlock completionBlock:(DXPhotoCompletionBlock)completionBlock {
    __weak typeof(self) wself = self;
    SDWebImageCompletionWithFinishedBlock finishBlock = ^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
        if (completionBlock) {
            completionBlock(wself, image);
        }
    };

    _operation = [[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:_imageURL] options:1 progress:nil completed:finishBlock];
}

- (void)cancelLoadImage {
    [_operation cancel];
    _operation = nil;
}

有关更多详细信息,最佳实践,请查看 DXSimplePhoto.

用法

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

要求

iOS '~6.0'

安装

DXPhotoBrowser 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行

pod "DXPhotoBrowser"

许可

DXPhotoBrowser 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。