Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangyongji
/
MRFramework
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2cb05fe1
authored
Sep 16, 2019
by
Sarkizz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加图片加载超时逻辑
parent
bb9f04c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
MRFramework/MRFramework/UIControls/Album/MRAlbumDetailViewController.swift
+11
-1
No files found.
MRFramework/MRFramework/UIControls/Album/MRAlbumDetailViewController.swift
View file @
2cb05fe1
...
...
@@ -26,6 +26,7 @@ open class MRAlbumDetailViewController: UIViewController {
public
static
var
checkedOptions
:
MRCheckBoxOptions
=
.
defaultCheck
(
checkboxSize
)
public
var
confirm
:
((
_
vc
:
MRAlbumDetailViewController
,
_
isSelected
:
Bool
)
->
Void
)?
public
var
requestTimeout
:
TimeInterval
=
20
public
var
assest
:
PHAsset
!
public
var
isSelected
=
false
...
...
@@ -35,6 +36,9 @@ open class MRAlbumDetailViewController: UIViewController {
private
let
imageView
=
UIImageView
()
private
let
checkButton
=
UIButton
(
type
:
.
custom
)
private
var
requestID
:
PHImageRequestID
?
private
var
countdownor
:
Countdown
?
private
var
state
:
AlbumDetailState
=
.
none
{
didSet
{
stateDidChange
()
...
...
@@ -110,12 +114,18 @@ extension MRAlbumDetailViewController {
let
options
=
PHImageRequestOptions
()
options
.
isNetworkAccessAllowed
=
true
options
.
isSynchronous
=
true
self
.
imageCache
.
requestImage
(
for
:
self
.
assest
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
options
,
resultHandler
:
{
(
image
,
_
)
in
self
.
requestID
=
self
.
imageCache
.
requestImage
(
for
:
self
.
assest
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
options
,
resultHandler
:
{
(
image
,
_
)
in
DispatchQueue
.
main
.
async
{
ToastView
.
hide
()
completion
(
image
,
nil
)
}
})
weak
var
weakSelf
=
self
self
.
countdownor
=
self
.
requestTimeout
.
countdown
({
(
_
,
_
,
_
,
sec
)
in
if
sec
<=
0
,
let
`
self
`
=
weakSelf
,
let
id
=
self
.
requestID
{
self
.
imageCache
.
cancelImageRequest
(
id
)
}
})
}
}
...
...
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