Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dz_TZImagePickerController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuijing
dz_TZImagePickerController
Commits
77daaa0f
Commit
77daaa0f
authored
Jun 02, 2017
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug: 预览iCloud大图时快速滑动图片显示错误
parent
c7f449cf
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
14 deletions
+25
-14
TZImagePickerController/TZImagePickerController/TZAssetCell.h
...agePickerController/TZImagePickerController/TZAssetCell.h
+1
-1
TZImagePickerController/TZImagePickerController/TZAssetCell.m
...agePickerController/TZImagePickerController/TZAssetCell.m
+2
-2
TZImagePickerController/TZImagePickerController/TZImageManager.h
...PickerController/TZImagePickerController/TZImageManager.h
+4
-4
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+5
-5
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.h
...erController/TZImagePickerController/TZPhotoPreviewCell.h
+2
-0
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
...erController/TZImagePickerController/TZPhotoPreviewCell.m
+11
-2
No files found.
TZImagePickerController/TZImagePickerController/TZAssetCell.h
View file @
77daaa0f
...
@@ -26,7 +26,7 @@ typedef enum : NSUInteger {
...
@@ -26,7 +26,7 @@ typedef enum : NSUInteger {
@property
(
nonatomic
,
assign
)
TZAssetCellType
type
;
@property
(
nonatomic
,
assign
)
TZAssetCellType
type
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingGif
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingGif
;
@property
(
nonatomic
,
copy
)
NSString
*
representedAssetIdentifier
;
@property
(
nonatomic
,
copy
)
NSString
*
representedAssetIdentifier
;
@property
(
nonatomic
,
assign
)
PHImageRequestID
imageRequestID
;
@property
(
nonatomic
,
assign
)
int32_t
imageRequestID
;
@property
(
nonatomic
,
copy
)
NSString
*
photoSelImageName
;
@property
(
nonatomic
,
copy
)
NSString
*
photoSelImageName
;
@property
(
nonatomic
,
copy
)
NSString
*
photoDefImageName
;
@property
(
nonatomic
,
copy
)
NSString
*
photoDefImageName
;
...
...
TZImagePickerController/TZImagePickerController/TZAssetCell.m
View file @
77daaa0f
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
@property
(
nonatomic
,
weak
)
UIImageView
*
videoImgView
;
@property
(
nonatomic
,
weak
)
UIImageView
*
videoImgView
;
@property
(
nonatomic
,
strong
)
TZProgressView
*
progressView
;
@property
(
nonatomic
,
strong
)
TZProgressView
*
progressView
;
@property
(
nonatomic
,
assign
)
PHImageRequestID
bigImageRequestID
;
@property
(
nonatomic
,
assign
)
int32_t
bigImageRequestID
;
@end
@end
@implementation
TZAssetCell
@implementation
TZAssetCell
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
if
(
iOS8Later
)
{
if
(
iOS8Later
)
{
self
.
representedAssetIdentifier
=
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
];
self
.
representedAssetIdentifier
=
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
];
}
}
PHImageRequestID
imageRequestID
=
[[
TZImageManager
manager
]
getPhotoWithAsset
:
model
.
asset
photoWidth
:
self
.
tz_width
completion
:^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
int32_t
imageRequestID
=
[[
TZImageManager
manager
]
getPhotoWithAsset
:
model
.
asset
photoWidth
:
self
.
tz_width
completion
:^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
if
(
_progressView
)
{
if
(
_progressView
)
{
self
.
progressView
.
hidden
=
YES
;
self
.
progressView
.
hidden
=
YES
;
self
.
imageView
.
alpha
=
1
.
0
;
self
.
imageView
.
alpha
=
1
.
0
;
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.h
View file @
77daaa0f
...
@@ -53,10 +53,10 @@
...
@@ -53,10 +53,10 @@
/// Get photo 获得照片
/// Get photo 获得照片
-
(
void
)
getPostImageWithAlbumModel
:(
TZAlbumModel
*
)
model
completion
:(
void
(
^
)(
UIImage
*
postImage
))
completion
;
-
(
void
)
getPostImageWithAlbumModel
:(
TZAlbumModel
*
)
model
completion
:(
void
(
^
)(
UIImage
*
postImage
))
completion
;
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
/// Get full Image 获取原图
/// Get full Image 获取原图
/// 该方法会先返回缩略图,再返回原图,如果info[PHImageResultIsDegradedKey] 为 YES,则表明当前返回的是缩略图,否则是原图。
/// 该方法会先返回缩略图,再返回原图,如果info[PHImageResultIsDegradedKey] 为 YES,则表明当前返回的是缩略图,否则是原图。
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
77daaa0f
...
@@ -389,7 +389,7 @@ static CGFloat TZScreenScale;
...
@@ -389,7 +389,7 @@ static CGFloat TZScreenScale;
#pragma mark - Get Photo
#pragma mark - Get Photo
/// Get photo 获得照片本身
/// Get photo 获得照片本身
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
,
NSDictionary
*
,
BOOL
isDegraded
))
completion
{
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
,
NSDictionary
*
,
BOOL
isDegraded
))
completion
{
CGFloat
fullScreenWidth
=
TZScreenWidth
;
CGFloat
fullScreenWidth
=
TZScreenWidth
;
if
(
fullScreenWidth
>
_photoPreviewMaxWidth
)
{
if
(
fullScreenWidth
>
_photoPreviewMaxWidth
)
{
fullScreenWidth
=
_photoPreviewMaxWidth
;
fullScreenWidth
=
_photoPreviewMaxWidth
;
...
@@ -397,11 +397,11 @@ static CGFloat TZScreenScale;
...
@@ -397,11 +397,11 @@ static CGFloat TZScreenScale;
return
[
self
getPhotoWithAsset
:
asset
photoWidth
:
fullScreenWidth
completion
:
completion
progressHandler
:
nil
networkAccessAllowed
:
YES
];
return
[
self
getPhotoWithAsset
:
asset
photoWidth
:
fullScreenWidth
completion
:
completion
progressHandler
:
nil
networkAccessAllowed
:
YES
];
}
}
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
{
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
{
return
[
self
getPhotoWithAsset
:
asset
photoWidth
:
photoWidth
completion
:
completion
progressHandler
:
nil
networkAccessAllowed
:
YES
];
return
[
self
getPhotoWithAsset
:
asset
photoWidth
:
photoWidth
completion
:
completion
progressHandler
:
nil
networkAccessAllowed
:
YES
];
}
}
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
{
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
{
CGFloat
fullScreenWidth
=
TZScreenWidth
;
CGFloat
fullScreenWidth
=
TZScreenWidth
;
if
(
fullScreenWidth
>
_photoPreviewMaxWidth
)
{
if
(
fullScreenWidth
>
_photoPreviewMaxWidth
)
{
fullScreenWidth
=
_photoPreviewMaxWidth
;
fullScreenWidth
=
_photoPreviewMaxWidth
;
...
@@ -409,7 +409,7 @@ static CGFloat TZScreenScale;
...
@@ -409,7 +409,7 @@ static CGFloat TZScreenScale;
return
[
self
getPhotoWithAsset
:
asset
photoWidth
:
fullScreenWidth
completion
:
completion
progressHandler
:
progressHandler
networkAccessAllowed
:
networkAccessAllowed
];
return
[
self
getPhotoWithAsset
:
asset
photoWidth
:
fullScreenWidth
completion
:
completion
progressHandler
:
progressHandler
networkAccessAllowed
:
networkAccessAllowed
];
}
}
-
(
PHImageRequestID
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
{
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
{
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
CGSize
imageSize
;
CGSize
imageSize
;
if
(
photoWidth
<
TZScreenWidth
&&
photoWidth
<
_photoPreviewMaxWidth
)
{
if
(
photoWidth
<
TZScreenWidth
&&
photoWidth
<
_photoPreviewMaxWidth
)
{
...
@@ -425,7 +425,7 @@ static CGFloat TZScreenScale;
...
@@ -425,7 +425,7 @@ static CGFloat TZScreenScale;
// 下面两行代码,来自hsjcom,他的github是:https://github.com/hsjcom 表示感谢
// 下面两行代码,来自hsjcom,他的github是:https://github.com/hsjcom 表示感谢
PHImageRequestOptions
*
option
=
[[
PHImageRequestOptions
alloc
]
init
];
PHImageRequestOptions
*
option
=
[[
PHImageRequestOptions
alloc
]
init
];
option
.
resizeMode
=
PHImageRequestOptionsResizeModeFast
;
option
.
resizeMode
=
PHImageRequestOptionsResizeModeFast
;
PHImageRequestID
imageRequestID
=
[[
PHImageManager
defaultManager
]
requestImageForAsset
:
asset
targetSize
:
imageSize
contentMode
:
PHImageContentModeAspectFill
options
:
option
resultHandler
:^
(
UIImage
*
_Nullable
result
,
NSDictionary
*
_Nullable
info
)
{
int32_t
imageRequestID
=
[[
PHImageManager
defaultManager
]
requestImageForAsset
:
asset
targetSize
:
imageSize
contentMode
:
PHImageContentModeAspectFill
options
:
option
resultHandler
:^
(
UIImage
*
_Nullable
result
,
NSDictionary
*
_Nullable
info
)
{
BOOL
downloadFinined
=
(
!
[[
info
objectForKey
:
PHImageCancelledKey
]
boolValue
]
&&
!
[
info
objectForKey
:
PHImageErrorKey
]);
BOOL
downloadFinined
=
(
!
[[
info
objectForKey
:
PHImageCancelledKey
]
boolValue
]
&&
!
[
info
objectForKey
:
PHImageErrorKey
]);
if
(
downloadFinined
&&
result
)
{
if
(
downloadFinined
&&
result
)
{
result
=
[
self
fixOrientation
:
result
];
result
=
[
self
fixOrientation
:
result
];
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.h
View file @
77daaa0f
...
@@ -39,5 +39,7 @@
...
@@ -39,5 +39,7 @@
@property
(
nonatomic
,
copy
)
void
(
^
singleTapGestureBlock
)();
@property
(
nonatomic
,
copy
)
void
(
^
singleTapGestureBlock
)();
@property
(
nonatomic
,
copy
)
void
(
^
imageProgressUpdateBlock
)(
double
progress
);
@property
(
nonatomic
,
copy
)
void
(
^
imageProgressUpdateBlock
)(
double
progress
);
@property
(
nonatomic
,
assign
)
int32_t
imageRequestID
;
-
(
void
)
recoverSubviews
;
-
(
void
)
recoverSubviews
;
@end
@end
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
View file @
77daaa0f
...
@@ -135,18 +135,27 @@
...
@@ -135,18 +135,27 @@
}
}
-
(
void
)
setAsset
:(
id
)
asset
{
-
(
void
)
setAsset
:(
id
)
asset
{
if
(
_asset
&&
self
.
imageRequestID
)
{
[[
PHImageManager
defaultManager
]
cancelImageRequest
:
self
.
imageRequestID
];
}
_asset
=
asset
;
_asset
=
asset
;
[[
TZImageManager
manager
]
getPhotoWithAsset
:
asset
completion
:
^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
self
.
imageRequestID
=
[[
TZImageManager
manager
]
getPhotoWithAsset
:
asset
completion
:
^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
if
(
!
[
asset
isEqual
:
_asset
])
return
;
self
.
imageView
.
image
=
photo
;
self
.
imageView
.
image
=
photo
;
[
self
resizeSubviews
];
[
self
resizeSubviews
];
_progressView
.
hidden
=
YES
;
_progressView
.
hidden
=
YES
;
if
(
self
.
imageProgressUpdateBlock
)
{
if
(
self
.
imageProgressUpdateBlock
)
{
self
.
imageProgressUpdateBlock
(
1
);
self
.
imageProgressUpdateBlock
(
1
);
}
}
if
(
!
isDegraded
)
{
self
.
imageRequestID
=
0
;
}
}
progressHandler
:^
(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
)
{
}
progressHandler
:^
(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
)
{
if
(
!
[
asset
isEqual
:
_asset
])
return
;
_progressView
.
hidden
=
NO
;
_progressView
.
hidden
=
NO
;
[
self
bringSubviewToFront
:
_progressView
];
[
self
bringSubviewToFront
:
_progressView
];
progress
=
progress
>
0
.
02
?
progress
:
0
.
02
;
;
progress
=
progress
>
0
.
02
?
progress
:
0
.
02
;
_progressView
.
progress
=
progress
;
_progressView
.
progress
=
progress
;
if
(
self
.
imageProgressUpdateBlock
)
{
if
(
self
.
imageProgressUpdateBlock
)
{
self
.
imageProgressUpdateBlock
(
progress
);
self
.
imageProgressUpdateBlock
(
progress
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment