Skip to content

Commit

Permalink
fix #405
Browse files Browse the repository at this point in the history
  • Loading branch information
longitachi committed Sep 2, 2019
1 parent 5567c13 commit b6b2fb6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "rs/SDWebImage" ~> 5.0.2
github "rs/SDWebImage" ~> 5.1.0


2 changes: 1 addition & 1 deletion Example/Example/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ - (IBAction)btnPreviewNetImageClick:(id)sender
GetDictForPreviewPhoto([NSURL URLWithString:@"http://pic.962.net/up/2013-11/20131111660842025734.jpg"], ZLPreviewPhotoTypeURLImage),
GetDictForPreviewPhoto([NSURL URLWithString:@"http://pic.962.net/up/2013-11/20131111660842034354.jpg"], ZLPreviewPhotoTypeURLImage),
GetDictForPreviewPhoto([NSURL URLWithString:@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1514184259027&di=a2e54cf2d5affe17acdaf1fbf19ff0af&imgtype=0&src=http%3A%2F%2Fimg5.duitang.com%2Fuploads%2Fitem%2F201212%2F25%2F20121225173302_wTjN8.jpeg"], ZLPreviewPhotoTypeURLImage),
GetDictForPreviewPhoto([NSURL URLWithString:@"https://pickcdn.mydesy.com/wp-content/uploads/2016/12/rgb-schemes2.gif"], ZLPreviewPhotoTypeURLImage)];
GetDictForPreviewPhoto([NSURL URLWithString:@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566386966005&di=adba0acdc81f732d75a1cc5a47f36c46&imgtype=0&src=http%3A%2F%2Fmsp.baidu.com%2Fv1%2Fmediaspot%2F968f19dc612b9e6d2f84a5149cd38b17.gif"], ZLPreviewPhotoTypeURLImage)];
[[self getPas] previewPhotos:arrNetImages index:0 hideToolBar:NO complete:^(NSArray * _Nonnull photos) {
NSLog(@"%@", photos);
}];
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
----------------------------------------

### 运行Demo
下载完Demo请执行`carthage update --platform iOS`
如果Demo报 `Duplicate interface definition for class''` 请到`Build Phases -> Headers`中,把`Public`中的头文件拖到`Protect`中即可
下载完Demo请执行`carthage update --platform iOS` (运行时候请选择 `Example` target)

### 框架整体介绍
* [功能介绍](#功能介绍)
Expand Down
6 changes: 4 additions & 2 deletions ZLPhotoBrowser/PhotoBrowser/ZLAlbumListController.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

ZLPhotoConfiguration *configuration = [(ZLImageNavigationController *)self.navigationController configuration];

@zl_weakify(self);

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
ZLPhotoConfiguration *configuration = [(ZLImageNavigationController *)self.navigationController configuration];
@zl_weakify(self);
[ZLPhotoManager getPhotoAblumList:configuration.allowSelectVideo allowSelectImage:configuration.allowSelectImage complete:^(NSArray<ZLAlbumListModel *> *albums) {
@zl_strongify(self);
self.arrayDataSources = [NSMutableArray arrayWithArray:albums];
Expand Down
2 changes: 1 addition & 1 deletion ZLPhotoBrowser/PhotoBrowser/ZLPhotoManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)saveVideoToAblum:(NSURL *)url completion:(void (^ _Nullable)(BOOL suc, PHAsset *asset))completion;

/**
* @brief 在全部照片中获取指定个数、排序方式的部分照片,在跳往预览大图界面时候video和gif均为no,不受参数影响
* @brief 在全部照片中获取指定个数、排序方式的部分照片
*/
+ (NSArray<ZLPhotoModel *> *)getAllAssetInPhotoAlbumWithAscending:(BOOL)ascending limitCount:(NSInteger)limit allowSelectVideo:(BOOL)allowSelectVideo allowSelectImage:(BOOL)allowSelectImage allowSelectGif:(BOOL)allowSelectGif allowSelectLivePhoto:(BOOL)allowSelectLivePhoto;

Expand Down
15 changes: 11 additions & 4 deletions ZLPhotoBrowser/PhotoBrowser/ZLThumbnailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,19 @@ - (void)refreshCellIndex {
ZLImageNavigationController *nav = (ZLImageNavigationController *)self.navigationController;
NSArray<NSIndexPath *> *visibleIndexPaths = self.collectionView.indexPathsForVisibleItems;
[visibleIndexPaths enumerateObjectsUsingBlock:^(NSIndexPath * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.row >= self.arrDataSources.count) {
// 拍照按钮 return
UICollectionViewCell *c = [self.collectionView cellForItemAtIndexPath:obj];
if ([c isKindOfClass:ZLTakePhotoCell.class]) {
// 拍照cell return
return;
}
ZLCollectionCell *cell = (ZLCollectionCell *)[self.collectionView cellForItemAtIndexPath:obj];
ZLPhotoModel *m = self.arrDataSources[obj.row];
ZLCollectionCell *cell = (ZLCollectionCell *)c;

NSInteger row = obj.row;
if (self.allowTakePhoto && !nav.configuration.sortAscending) {
row = obj.row - 1;
}

ZLPhotoModel *m = self.arrDataSources[row];
__block BOOL shouldShow = NO;
__block NSInteger index = 0;
[nav.arrSelectedModels enumerateObjectsUsingBlock:^(ZLPhotoModel * _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop) {
Expand Down

0 comments on commit b6b2fb6

Please sign in to comment.