TOCropViewController icon indicating copy to clipboard operation
TOCropViewController copied to clipboard

Accesing cropView

Open Calugarul opened this issue 5 years ago • 1 comments

Hi, is there a way to use TOCropViewController to add some image effects? Basically, I need to be able to access the image that will be set as cropped.

I already managed to place the navigation bar, add a button and made a collectionView with the Image effects. Upon selection, it will send back to previewController that will make a new TOCropView and the image will be shown with the effect but when it saves is still the original image and without crop. I understand I am not modifying the main cropView, it still exists and that is the one being sent. Is there a way to achieve this? This is my code:


func comingBackFromEffects() {
        var cropView = TOCropView()
        cropView.contentMode = .scaleAspectFit
        cropView = TOCropView(image: PassDataToChat.ImageToSend.image!)
        cropView.imageCropFrame = self.cropView.imageCropFrame
        cropView.frame = self.cropView.frame
        cropView.resetLayoutToDefault(animated: false)
        
        //self.cropView.removeFromSuperview()
        self.view.addSubview(cropView)
        self.view.layoutIfNeeded()
    }

Calugarul avatar Jun 02 '19 21:06 Calugarul

Hi @MarianPetrisor! Sorry for the late reply!

Hmm, this is an interesting use-case! I never really designed the controller with the ability to hot-swap images in and out.

One thing you might be able to do is capture the CGRect output from the crop controller and manually do your own cropping operation on the image with the effects applied.

Without modifying the code, there's not too much else you can do, sorry!

TimOliver avatar Sep 16 '19 04:09 TimOliver