Commit 79aa06f8 by Sarkizz

fix

parent 2a9cb705
...@@ -76,7 +76,7 @@ public class SAPhotoPicker: NSObject { ...@@ -76,7 +76,7 @@ public class SAPhotoPicker: NSObject {
})) }))
alert.addAction(UIAlertAction(title: config[.albumTitle] as? String, alert.addAction(UIAlertAction(title: config[.albumTitle] as? String,
style: .default, handler: { _ in style: .default, handler: { _ in
self.showCustomAlbum(count) 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, 0, nil)
...@@ -93,7 +93,7 @@ public class SAPhotoPicker: NSObject { ...@@ -93,7 +93,7 @@ public class SAPhotoPicker: NSObject {
self.showImagePicker(.savedPhotosAlbum) self.showImagePicker(.savedPhotosAlbum)
break break
case .custom(let count): case .custom(let count):
self.showCustomAlbum(count) self.showCustomAlbum(count, from: viewController)
break break
} }
} }
...@@ -109,7 +109,7 @@ extension SAPhotoPicker { ...@@ -109,7 +109,7 @@ extension SAPhotoPicker {
UIApplication.shared.keyWindow?.rootViewController?.present(vc, animated: true, completion: nil) UIApplication.shared.keyWindow?.rootViewController?.present(vc, animated: true, completion: nil)
} }
private func showCustomAlbum(_ count: Int) { private func showCustomAlbum(_ count: Int, from viewController: UIViewController?) {
let vc = MRAlbumListViewController() let vc = MRAlbumListViewController()
vc.title = config[.albumTitle] as? String vc.title = config[.albumTitle] as? String
vc.maxCount = count vc.maxCount = count
...@@ -124,7 +124,11 @@ extension SAPhotoPicker { ...@@ -124,7 +124,11 @@ extension SAPhotoPicker {
} }
customAlbumSetting?(self, vc) customAlbumSetting?(self, vc)
let nav = UINavigationController(rootViewController: vc) let nav = UINavigationController(rootViewController: vc)
UIApplication.shared.keyWindow?.rootViewController?.present(nav, animated: true, completion: nil) if let from = viewController {
from.present(nav, animated: true)
} else {
UIApplication.shared.keyWindow?.rootViewController?.present(nav, animated: true)
}
} }
private func navTitle(with sourceType: UIImagePickerController.SourceType) -> String? { private func navTitle(with sourceType: UIImagePickerController.SourceType) -> String? {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment