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 {
...
@@ -37,7 +37,7 @@ public enum SAPhotoPickerType {
case
custom
(
count
:
Int
)
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
public
typealias
SAPhotoPickerAlbumSetting
=
(
_
picker
:
SAPhotoPicker
,
_
vc
:
MRAlbumListViewController
)
->
Void
// MARK: - Config
// MARK: - Config
extension
SAPhotoPicker
{
extension
SAPhotoPicker
{
...
@@ -93,7 +93,7 @@ public class SAPhotoPicker: NSObject {
...
@@ -93,7 +93,7 @@ public class SAPhotoPicker: NSObject {
self
.
showCustomAlbum
(
count
,
from
:
viewController
)
self
.
showCustomAlbum
(
count
,
from
:
viewController
)
}))
}))
alert
.
addAction
(
UIAlertAction
(
title
:
"取消"
,
style
:
.
cancel
,
handler
:
{
_
in
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
)
UIApplication
.
shared
.
keyWindow
?
.
rootViewController
?
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
case
.
photo
:
case
.
photo
:
...
@@ -127,13 +127,12 @@ extension SAPhotoPicker {
...
@@ -127,13 +127,12 @@ extension SAPhotoPicker {
vc
.
title
=
config
[
.
albumTitle
]
as?
String
vc
.
title
=
config
[
.
albumTitle
]
as?
String
vc
.
maxCount
=
count
vc
.
maxCount
=
count
vc
.
maxImageSize
=
imageMaxSize
vc
.
maxImageSize
=
imageMaxSize
vc
.
modalPresentationStyle
=
.
fullScreen
vc
.
didConfirm
=
{
vc
,
images
,
count
in
vc
.
didConfirm
=
{
vc
,
images
,
count
in
self
.
complateBlock
?(
images
,
nil
,
count
,
nil
)
self
.
complateBlock
?(
vc
,
images
,
nil
,
count
,
nil
)
vc
.
dismiss
(
animated
:
true
)
}
}
vc
.
didCancel
=
{
vc
in
vc
.
didCancel
=
{
vc
in
self
.
complateBlock
?(
nil
,
nil
,
0
,
nil
)
self
.
complateBlock
?(
vc
,
nil
,
nil
,
0
,
nil
)
vc
.
dismiss
(
animated
:
true
)
}
}
customAlbumSetting
?(
self
,
vc
)
customAlbumSetting
?(
self
,
vc
)
let
nav
=
UINavigationController
(
rootViewController
:
vc
)
let
nav
=
UINavigationController
(
rootViewController
:
vc
)
...
@@ -174,15 +173,15 @@ extension SAPhotoPicker: UINavigationControllerDelegate, UIImagePickerController
...
@@ -174,15 +173,15 @@ extension SAPhotoPicker: UINavigationControllerDelegate, UIImagePickerController
if
let
image
=
image
{
if
let
image
=
image
{
let
url
=
info
[
.
referenceURL
]
as?
URL
let
url
=
info
[
.
referenceURL
]
as?
URL
complateBlock
?([
image
],
url
==
nil
?
nil
:
[
url
!
],
0
,
nil
)
complateBlock
?(
picker
,
[
image
],
url
==
nil
?
nil
:
[
url
!
],
0
,
nil
)
}
else
{
}
else
{
complateBlock
?(
nil
,
nil
,
0
,
error
(
code
:
-
1
,
msg
:
"获取图片失败"
))
complateBlock
?(
picker
,
nil
,
nil
,
0
,
error
(
code
:
-
1
,
msg
:
"获取图片失败"
))
}
}
picker
.
dismiss
(
animated
:
true
)
picker
.
dismiss
(
animated
:
true
)
}
}
public
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
public
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
complateBlock
?(
nil
,
nil
,
0
,
nil
)
complateBlock
?(
picker
,
nil
,
nil
,
0
,
nil
)
picker
.
dismiss
(
animated
:
true
)
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