swift2 从多媒体资料上传图像

rbl8hiat  于 2022-11-06  发布在  Swift
关注(0)|答案(2)|浏览(207)

我是swift的新手。我正在创建一个应用程序,我需要从图库上传图片。我如何从图库上传多张图片到我的应用程序。有人能帮我吗?提前感谢。

kpbpu008

kpbpu0081#

试试这个可能会有帮助!!
//转到Galary进行图像拾取

if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
        let imagePicker = UIImagePickerController()
        imagePicker.delegate = refrenceViewController as! UIImagePickerControllerDelegate & UINavigationControllerDelegate
        imagePicker.sourceType = .photoLibrary;
        imagePicker.allowsEditing = true
        refrenceViewController.present(imagePicker, animated: true, completion: nil)

    }

并添加对info.plist权限和访问galary的顺序

wecizke3

wecizke32#

你一次只能从Apple Photo FrameWork获取一张图片。如果你想允许多张图片,请使用Librarys。我也在我的一个应用程序中使用BSImagePicker

相关问题