Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fusumaMultipleImageSelected not getting called. #292

Open
StellarKuldeep opened this issue May 15, 2019 · 3 comments
Open

fusumaMultipleImageSelected not getting called. #292

StellarKuldeep opened this issue May 15, 2019 · 3 comments

Comments

@StellarKuldeep
Copy link

StellarKuldeep commented May 15, 2019

I'm trying to allow the user to select multiple images and for that I have tried below code.

let fusuma = FusumaViewController()
fusuma.delegate = self
fusuma.cropHeightRatio = 1.0
fusuma.allowMultipleSelection = true
fusuma.availableModes = [.library, .video, .camera]
fusuma.photoSelectionLimit = 4
fusumaTintColor = UIColor.red
fusumaSavesImage = true

present(fusuma, animated: true, completion: nil)

If I write fusuma.allowMultipleSelection = false then delegate getting called but when I have tried fusuma.allowMultipleSelection = true then delegate not getting called.

// MARK: FusumaDelegate Protocol
    func fusumaImageSelected(_ image: UIImage, source: FusumaMode) {
        switch source {
        case .camera:
            print("Image captured from Camera")
        case .library:
            print("Image selected from Camera Roll")
        default:
            print("Image selected")
        }

        imageView.image = image
    }

    func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode) {
        print("Number of selection images: \(images.count)")

        var count: Double = 0

        for image in images {
            DispatchQueue.main.asyncAfter(deadline: .now() + (3.0 * count)) {
                self.imageView.image = image
                print("w: \(image.size.width) - h: \(image.size.height)")
            }

            count += 1
        }
    }

I tried this in downloaded demo but it's not working.

@Verteletsky
Copy link

+1, dont worked

@paulsUsername
Copy link

paulsUsername commented Jun 13, 2019

You need to use the following method to get callbacks:

func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode, metaData: [ImageMetadata]) {

}

Note that this method has metaData property. There is an error in the protocol that it is only pulling up the method without the metaData. If you examine the FusumaViewController you'll see that the non metaData version is never called. Using the above method resolves it straight away.

@ChopinDavid
Copy link

ChopinDavid commented Oct 10, 2019

This should probably be fixed. The required protocol stub for the delegate is:

is func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode) {

}

Not

func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode, metaData: [ImageMetadata]) {

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants