DZNPhotoPickerController icon indicating copy to clipboard operation
DZNPhotoPickerController copied to clipboard

Photo picker in swift

Open black-lotus opened this issue 8 years ago • 6 comments

Hi,

First of all Thank you so much for making this awesome library :)

I have question, how to implement editor picker in swift since i always getting warning error In my case, photo will cropping after photo selected from photo library or by camera.

here is my code

func takePictureFromLiblary(){
        let imagePicker =  UIImagePickerController()
        imagePicker.allowsEditing = true
        imagePicker.cropMode = DZNPhotoEditorViewControllerCropMode.Circular
        imagePicker.delegate = self

        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) {

            imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary

        } else if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum) {

            imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum

        } else {

            JLToast.makeText("Galery not available, please check your camera and try again", duration:JLToastDelay.ShortDelay).show()

        }


        imagePicker.finalizationBlock = { (picker: UIImagePickerController, info: NSDictionary) in

        }

        imagePicker.cancellationBlock = { (picker: UIImagePickerController) in

        }


        self.presentViewController(imagePicker, animated: true, completion: nil)
}

and here is warning error message

Cannot assign value of type '(UIImagePickerController, NSDictionary) -> ()' to type 'UIImagePickerControllerFinalizationBlock!'
Cannot assign value of type '(UIImagePickerController) -> ()' to type 'UIImagePickerControllerCancellationBlock!'

Any help would be appreciated :) Thank you for advance

black-lotus avatar Oct 24 '16 05:10 black-lotus

I get the same error after migrating from Swift 2.3 to Swift 3.0

Richard3332 avatar Dec 12 '16 17:12 Richard3332

@ReadmeCritic any solution how to fix?

yarodevuci avatar Dec 24 '16 08:12 yarodevuci

nope... I switch to other library.. it simple but it works here you go https://github.com/ruslanskorb/RSKImageCropper

black-lotus avatar Dec 24 '16 10:12 black-lotus

u meant to msg @dzenbot ?

ReadmeCritic avatar Dec 26 '16 18:12 ReadmeCritic

Any update on this if it will be updated for Swift 3.0?

Richard3332 avatar Jan 17 '17 21:01 Richard3332

Please update code like that

	picker.finalizationBlock = { (picker, info) in
		//Your code here...
	}
	
	picker.cancellationBlock = { (picker) in
		//Your code here...
	}

rollr76518 avatar Aug 29 '17 10:08 rollr76518