相关疑难解决方法(0)

选择多个图像(UIImagePickerController或Photos.app共享UI)

在iPhone OS 3.0中,Apple添加了使用"共享"按钮一次共享多张图片并选择多个图像(使用复选标记)的功能.

我想拥有一个UIImagePickerController,它允许用户一次选择多个图像,而不必一个一个地去.有没有办法做到这一点,还是我必须等到他们添加此功能?

iphone uiimagepickercontroller ios

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

使用UIActivityViewController未将多张图像保存在照片库中

我需要在照片库中保存多个图像,用户可以从应用程序库中多次选择图像,然后将它们保存在iPhone照片库中.我正在展示UIActivityViewController这个目的.

假设用户选择10个或更多图像并选择将它们保存到照片库中,则仅保存7-8个图像.

有什么办法可以在没有任何故障的情况下保存照片库中的图像数组吗?

谢谢

let images = Generic.fetchImagesFromMediaFiles(self.selectedMediaObj) // to fetch selected images

let activityViewController = UIActivityViewController(activityItems: images, applicationActivities: nil)
self.present(activityViewController, animated: true, completion: nil);

if let popoverPresentationController = activityViewController.popoverPresentationController {
    popoverPresentationController.sourceView = self.shareAllView
}
Run Code Online (Sandbox Code Playgroud)

uiimage ios uiactivityviewcontroller swift

5
推荐指数
1
解决办法
365
查看次数

Swift 3使用UIImagePickerController选择多张照片

我有一个UIImagePickerController用它从库中选择一张照片,或用相机拍照,然后在一张照片中显示所选照片UIImageView.我想稍后将这张照片上传到API(它仍然不知道如何上传照片,从未做过).

所以我想要的是像WhatsApp选择照片功能这样的功能,您可以选择让我们说20张照片,然后您就可以看到它们.(我的意思是我的情况,我只有一张UIImageView,只能显示一张照片.

解决办法是什么?请记住,我想稍后上传这些照片.

提前致谢

uiimagepickercontroller swift3

4
推荐指数
1
解决办法
9609
查看次数

如何在 SwiftUI 中从图库中选择图像

我尝试制作一个符合 UIViewRepresentable 并实现 makeUIView 和 updateUIView 的 SwiftUI 类。但无法完成它。这是代码:

代码:

struct ImagePicker : UIViewRepresentable {

@Binding var image: UIImage

class Coordinator: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

    @Binding var image: UIImage

    init(image: Binding<UIImage>) {
        $image = image
    }

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {


        if let possibleImage = info[.editedImage] as? UIImage {
            image = possibleImage
        } else if let possibleImage = info[.originalImage] as? UIImage {
            image = possibleImage
        } else {

        }
    }
}

func makeCoordinator() -> Coordinator …
Run Code Online (Sandbox Code Playgroud)

uiimagepickercontroller swift swiftui

3
推荐指数
1
解决办法
3032
查看次数

如何在 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万
查看次数