如何在iOS中用swift使用多个图像select器

我正在约会应用程序。 如您所知,用户需要在约会应用程序中注册多个图片。

所以我得到了如何在一个视图中使用1个图像select器。

但我不知道如何添加多个图像select器。

我知道我只能用一个

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { } 

 func imagePickerControllerDidCancel(picker: UIImagePickerController) { picker.dismissViewControllerAnimated(false, completion:nil) } 

所以我不能find多个imagepicker视图的解决scheme。

我的失败代码如下。

 import UIKit class RegisterPicture : UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { @IBAction func pick1(sender: AnyObject) { let picker1 = UIImagePickerController() picker1.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum picker1.allowsEditing = true picker1.delegate = self self.presentViewController(picker1, animated: false, completion: nil) } @IBAction func pick2(sender: AnyObject) { let picker2 = UIImagePickerController() picker2.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum picker2.allowsEditing = true picker2.delegate = self self.presentViewController(picker2, animated: false, completion: nil) } @IBOutlet var picture1: UIImageView! @IBOutlet var picture2: UIImageView! func imagePickerController(picker1: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { picker1.dismissViewControllerAnimated(false, completion : nil) self.picture1.image = info[UIImagePickerControllerOriginalImage] as? UIImage } func imagePickerController(picker2: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { picker2.dismissViewControllerAnimated(false, completion : nil) self.picture2.image = info[UIImagePickerControllerOriginalImage] as? UIImage } func imagePickerControllerDidCancel(picker1: UIImagePickerController) { picker1.dismissViewControllerAnimated(false, completion:nil) } func imagePickerControllerDidCancel(picker2: UIImagePickerController) { picker2.dismissViewControllerAnimated(false, completion:nil) } } 

使用UIImagePickerController不能select多个图像。 你要么必须制作自己的自定义图像select器,要么使用像这样的第三方。

我试图find一个与iOS照片应用程序的用户界面类似的select器,这个应用程序为相册和资产同步进行了优化,但是我找不到这样的控制器,最后我做了我自己的。 它具有强大的定制能力,支持多选,自定义sorting和筛选,并且完全用现代Swift 3.0编写。 如果有人发现它的错误,我会解决它们给你:)你可以尝试这个链接。 https://github.com/DragonCherry/AssetsPickerViewController