DDPhotoBrowser 2.0.2

DDPhotoBrowser 2.0.2

liuhedong 维护。



  • liuhedong

DDPhotoBrowser

示例

简单实用

NSMutableArray *imageDataArray = [NSMutableArray array];
NSInteger startIndex = tap.view.tag - 1;
[self.urls enumerateObjectsUsingBlock:^(NSString *   _Nonnull urlString, NSUInteger idx, BOOL * _Nonnull stop) {
                
    UIImageView * imageView = [self.view viewWithTag:1+idx];
    
    DDPhotoItem *item = [DDPhotoItem itemWithSourceView:imageView imageUrl:[NSURL URLWithString:urlString] thumbImage:nil thumbImageUrl:nil];
    
    if (idx == startIndex) {
        item.firstShowAnimation = YES;
    }
    
    [imageDataArray addObject:item];
}];

/// 配置自定义下载
DDPhotoSDImageDownloadEngine * downloadEngine = [DDPhotoSDImageDownloadEngine new];

/// DDSDAnimatedImageView 配置显示图片 的 view

/** 图片选择器展示*/
DDPhotoBrowser * b = [DDPhotoBrowser photoBrowserWithPhotoItems:imageDataArray currentIndex:startIndex getImageViewClass:DDSDAnimatedImageView.class downloadEngine:downloadEngine];

/** 设置page类型 */
b.pageIndicateStyle = DDPhotoBrowserPageIndicateStylePageLabel;

b.longPressGestureClickedBlock = ^(DDPhotoBrowser * photoBrowser ,NSInteger index, DDPhotoItem *item,NSData * imageData) {
    NSLog(@"长按手势回调:%ld", index);
};
    
[b showFromVC:self];

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

需求

安装

DDPhotoBrowser 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod 'DDPhotoBrowser'

作者

[email protected][email protected]

许可证

DDPhotoBrowser采用MIT许可证。更多信息请参阅LICENSE文件。