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
c48d0090
authored
Dec 23, 2019
by
Sarkizz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
回调添加自身vc
parent
ac4c3356
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
MRFramework/MRFramework/UIControls/PhotoPicker/SAPhotoPicker.swift
+8
-9
No files found.
MRFramework/MRFramework/UIControls/PhotoPicker/SAPhotoPicker.swift
View file @
c48d0090
...
...
@@ -37,7 +37,7 @@ public enum SAPhotoPickerType {
case
custom
(
count
:
Int
)
}
public
typealias
SAPhotoPickerComplateBlock
=
(
_
images
:
[
UIImage
]?,
_
imageURLs
:
[
URL
]?,
_
failedCount
:
Int
,
_
error
:
Error
?)
->
Void
public
typealias
SAPhotoPickerComplateBlock
=
(
_
vc
:
UIViewController
?,
_
images
:
[
UIImage
]?,
_
imageURLs
:
[
URL
]?,
_
failedCount
:
Int
,
_
error
:
Error
?)
->
Void
public
typealias
SAPhotoPickerAlbumSetting
=
(
_
picker
:
SAPhotoPicker
,
_
vc
:
MRAlbumListViewController
)
->
Void
// MARK: - Config
extension
SAPhotoPicker
{
...
...
@@ -93,7 +93,7 @@ public class SAPhotoPicker: NSObject {
self
.
showCustomAlbum
(
count
,
from
:
viewController
)
}))
alert
.
addAction
(
UIAlertAction
(
title
:
"取消"
,
style
:
.
cancel
,
handler
:
{
_
in
complate
?(
nil
,
nil
,
0
,
nil
)
complate
?(
nil
,
nil
,
nil
,
0
,
nil
)
}))
UIApplication
.
shared
.
keyWindow
?
.
rootViewController
?
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
case
.
photo
:
...
...
@@ -127,13 +127,12 @@ extension SAPhotoPicker {
vc
.
title
=
config
[
.
albumTitle
]
as?
String
vc
.
maxCount
=
count
vc
.
maxImageSize
=
imageMaxSize
vc
.
modalPresentationStyle
=
.
fullScreen
vc
.
didConfirm
=
{
vc
,
images
,
count
in
self
.
complateBlock
?(
images
,
nil
,
count
,
nil
)
vc
.
dismiss
(
animated
:
true
)
self
.
complateBlock
?(
vc
,
images
,
nil
,
count
,
nil
)
}
vc
.
didCancel
=
{
vc
in
self
.
complateBlock
?(
nil
,
nil
,
0
,
nil
)
vc
.
dismiss
(
animated
:
true
)
self
.
complateBlock
?(
vc
,
nil
,
nil
,
0
,
nil
)
}
customAlbumSetting
?(
self
,
vc
)
let
nav
=
UINavigationController
(
rootViewController
:
vc
)
...
...
@@ -174,15 +173,15 @@ extension SAPhotoPicker: UINavigationControllerDelegate, UIImagePickerController
if
let
image
=
image
{
let
url
=
info
[
.
referenceURL
]
as?
URL
complateBlock
?([
image
],
url
==
nil
?
nil
:
[
url
!
],
0
,
nil
)
complateBlock
?(
picker
,
[
image
],
url
==
nil
?
nil
:
[
url
!
],
0
,
nil
)
}
else
{
complateBlock
?(
nil
,
nil
,
0
,
error
(
code
:
-
1
,
msg
:
"获取图片失败"
))
complateBlock
?(
picker
,
nil
,
nil
,
0
,
error
(
code
:
-
1
,
msg
:
"获取图片失败"
))
}
picker
.
dismiss
(
animated
:
true
)
}
public
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
complateBlock
?(
nil
,
nil
,
0
,
nil
)
complateBlock
?(
picker
,
nil
,
nil
,
0
,
nil
)
picker
.
dismiss
(
animated
:
true
)
}
}
...
...
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