【问题标题】:Upload images from gallery从图库上传图片
【发布时间】:2018-06-25 22:16:31
【问题描述】:

我是 swift 新手。我正在创建一个需要从图库上传图像的应用程序。如何将画廊中的多个图像上传到我的应用程序。有人可以帮帮我吗。 提前致谢。

【问题讨论】:

  • 如果您想使用默认的苹果框架 Photos FrameWork 用于此目的,或者您可以寻找也可用于此目的的库,首选照片框架

标签: swift swift3 swift2


【解决方案1】:

试试这个可能会有帮助!!

//去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 和 order 上添加访问 galary 的权限

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2017-12-25
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 2013-06-21
      • 1970-01-01
      • 2017-06-13
      • 2011-08-27
      • 2015-11-29
      相关资源
      最近更新 更多