测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
Released最后发布 | 2017年11月 |
由 Cheng Jie 维护。
依赖 | |
CJProgressHUD | >= 0 |
SDWebImage | >= 0 |
一个 iOS 的自定义图片浏览器
使用 CocoaPods
pod 'CJImageBrowser', '1.0.1'
or
pod 'CJImageBrowser'
这个图片浏览框架经过两次修改,使其与今日头条、腾讯新闻、网易新闻的图片浏览框架非常相似!
将来我们还会维护和修改它,如果您在使用过程中遇到任何问题,请在我 GitHub 上留言!
如果您想在动作回调中使用此图片浏览器,例如
collectionView:didSelectItemAtIndexPath:
方法,如下所示
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
CJCollectionViewCell *iamgeCell = (CJCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
NSInteger count = self.imageArray.count;
// 1.封装图片数据
NSMutableArray *photos = [NSMutableArray arrayWithCapacity:count];
for (int i = 0; i < count; i++) {
CJImageInfo *photo = [[CJImageInfo alloc] init];
photo.url = [NSURL URLWithString:[self.imageArray[i] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]]; // 图片路径
if (indexPath.row == i) {
photo.srcImageView = [iamgeCell imageView]; // 来源于哪个UIImageView
}
[photos addObject:photo];
}
// 2.显示相册
CJImageBrowser *browser = [[CJImageBrowser alloc] init];
browser.currentPhotoIndex = indexPath.row; // 弹出相册时显示的第一张图片是?
browser.photos = photos; // 设置所有的图片
[browser show];
}
1.0.1 - 修复了 SVProgressHud,以便在图像浏览器中作为依赖项的 -CJ。
1.0.0 - 一个简单的 iOS 图片浏览器。
MIT