小编kim*_*pro的帖子

如何在 iOS 中快速使用多个图像选择器

我正在制作约会应用程序。如您所知,用户需要在约会应用程序中注册多张照片。

所以我知道了如何在一个视图中使用 1 个图像选择器。

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

我知道我只能使用一个

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {  
}
Run Code Online (Sandbox Code Playgroud)

func imagePickerControllerDidCancel(picker: UIImagePickerController) {
    picker.dismissViewControllerAnimated(false, completion:nil)
}
Run Code Online (Sandbox Code Playgroud)

所以我找不到多个图像选择器视图的解决方案。

我的失败代码如下。

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, …
Run Code Online (Sandbox Code Playgroud)

ios swift

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

ios ×1

swift ×1