Skip to content

Commit 14670c4

Browse files
committed
优化获取GIF图的一些细节;发布2.1.8版本
1 parent ce534e1 commit 14670c4

File tree

7 files changed

+33
-26
lines changed

7 files changed

+33
-26
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## 重要提示1:提issue前请先搜索,先从已有issue里找找线索。如果发现bug,请先和Demo对照自查下,如果Demo也有bug,请再提issue。Demo正常你那不正常的,提issue时请贴上你的初始化代码,注明必要的复现步骤。这样能避免多余的沟通,帮助你更快获取答案。
1010

11-
## 重要提示2:1.9.0版本后移除了"prefs:root="的调用,这个API已经被列为私有API,请大家尽快升级。目前最新版本2.1.7
11+
## 重要提示2:1.9.0版本后移除了"prefs:root="的调用,这个API已经被列为私有API,请大家尽快升级。目前最新版本2.1.8
1212

1313
关于升级iOS10和Xcdoe8的提示:
1414
在Xcode8环境下将项目运行在iOS10的设备/模拟器中,访问相册和相机需要额外配置info.plist文件。分别是Privacy - Photo Library Usage Description和Privacy - Camera Usage Description字段,详见Demo中info.plist中的设置。
@@ -97,7 +97,7 @@ A:1.8.4版本已支持
9797
A:考虑下,优先级低
9898

9999
最近更新
100-
2.1.7 优化gif图播放的体验,加入iCloud同步进度条;新增notScaleImage属性,设置为YES时内部不去缩放图片
100+
2.1.8 优化gif图播放的体验,加入iCloud同步进度条;新增notScaleImage属性,设置为YES时内部不去缩放图片
101101
2.1.6 新增allowCameraLocation属性,默认为YES,置为NO时不会在照相/摄像时定位,修复一个序号紊乱的bug
102102
2.1.5 修复开启showSelectedIndex后照片列表页iCloud图片进度条紊乱的bug
103103
2.1.4 新增多个页面和组件的样式自定义block,允许自定义绝大多数UI样式

TZImagePickerController.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Pod::Spec.new do |s|
22
s.name = "TZImagePickerController"
3-
s.version = "2.1.7"
3+
s.version = "2.1.8"
44
s.summary = "A clone of UIImagePickerController, support picking multiple photos、original photo and video"
55
s.homepage = "https://github.com/banchichen/TZImagePickerController"
66
s.license = "MIT"
77
s.author = { "banchichen" => "tanzhenios@foxmail.com" }
88
s.platform = :ios
99
s.ios.deployment_target = "6.0"
10-
s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "2.1.7" }
10+
s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "2.1.8" }
1111
s.requires_arc = true
1212
s.resources = "TZImagePickerController/TZImagePickerController/*.{png,bundle}"
1313
s.source_files = "TZImagePickerController/TZImagePickerController/*.{h,m}"

TZImagePickerController/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.7</string>
18+
<string>2.1.8</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

TZImagePickerController/TZImagePickerController/TZImagePickerController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// Created by 谭真 on 15/12/24.
66
// Copyright © 2015年 谭真. All rights reserved.
7-
// version 2.1.7 - 2018.07.05
7+
// version 2.1.8 - 2018.07.05
88
// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
99

1010
/*

TZImagePickerController/TZImagePickerController/TZImagePickerController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// Created by 谭真 on 15/12/24.
66
// Copyright © 2015年 谭真. All rights reserved.
7-
// version 2.1.7 - 2018.07.05
7+
// version 2.1.8 - 2018.07.05
88
// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
99

1010
#import "TZImagePickerController.h"

TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ - (void)layoutSubviews {
9292

9393

9494
@interface TZPhotoPreviewView ()<UIScrollViewDelegate>
95-
95+
@property (assign, nonatomic) BOOL isRequestingGIF;
9696
@end
9797

9898
@implementation TZPhotoPreviewView
@@ -149,32 +149,39 @@ - (void)configProgressView {
149149

150150
- (void)setModel:(TZAssetModel *)model {
151151
_model = model;
152+
self.isRequestingGIF = NO;
152153
[_scrollView setZoomScale:1.0 animated:NO];
153154
if (model.type == TZAssetModelMediaTypePhotoGif) {
154155
// 先显示缩略图
155156
[[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
156157
self.imageView.image = photo;
157158
[self resizeSubviews];
159+
if (self.isRequestingGIF) {
160+
return;
161+
}
158162
// 再显示gif动图
159-
if (!isDegraded) {
160-
[[TZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
161-
progress = progress > 0.02 ? progress : 0.02;
162-
dispatch_async(dispatch_get_main_queue(), ^{
163-
self.progressView.progress = progress;
164-
if (progress >= 1) {
165-
self.progressView.hidden = YES;
166-
} else {
167-
self.progressView.hidden = NO;
168-
}
169-
});
170-
} completion:^(NSData *data, NSDictionary *info, BOOL isDegraded) {
171-
if (!isDegraded) {
163+
self.isRequestingGIF = YES;
164+
[[TZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
165+
progress = progress > 0.02 ? progress : 0.02;
166+
dispatch_async(dispatch_get_main_queue(), ^{
167+
self.progressView.progress = progress;
168+
if (progress >= 1) {
172169
self.progressView.hidden = YES;
173-
self.imageView.image = [UIImage sd_tz_animatedGIFWithData:data];
174-
[self resizeSubviews];
170+
} else {
171+
self.progressView.hidden = NO;
175172
}
176-
}];
177-
}
173+
});
174+
#ifdef DEBUG
175+
NSLog(@"[TZImagePickerController] getOriginalPhotoDataWithAsset:%f error:%@", progress, error);
176+
#endif
177+
} completion:^(NSData *data, NSDictionary *info, BOOL isDegraded) {
178+
if (!isDegraded) {
179+
self.isRequestingGIF = NO;
180+
self.progressView.hidden = YES;
181+
self.imageView.image = [UIImage sd_tz_animatedGIFWithData:data];
182+
[self resizeSubviews];
183+
}
184+
}];
178185
} progressHandler:nil networkAccessAllowed:NO];
179186
} else {
180187
self.asset = model.asset;

TZImagePickerControllerFramework/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1.7</string>
18+
<string>2.1.8</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

0 commit comments

Comments
 (0)