2

So what I have:

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info:[String : Any]) {
    let tempImage: UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage
    let imagetoTransmit: UIImage = tempImage
    shootedImage = imagetoTransmit
    self.performSegue(withIdentifier: "cameraSegueIdent", sender: nil)
    dismiss(animated: true, completion: nil)
}

where Segue:

 override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "cameraSegueIdent" {
        let imageToTransmit: UIImage = shootedImage
        let viewController = (segue.destination as! TakenPhotoPreviewViewController)
        viewController.takenImage = imageToTransmit
    } 
}

The Image is being sent, but the Segue does not perform.
Please help!

UPDATE

I went with the idea to send the image as sender, without saving in current ViewController and it worked like a charm!

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

    let tempImage: UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage
    self.dismiss(animated: true) {
    self.performSegue(withIdentifier: "cameraSegueIdent", sender: tempImage)
    }
}
2
  • 1
    Is there an error message? Maybe do the performSegue in the completion of the dismiss? Commented Oct 7, 2016 at 14:39
  • 2
    You need to do something like this, stackoverflow.com/a/39146965/6433023 in this answer of my i have present new controller instead of that in the completion block you need to call performSegue method. Commented Oct 7, 2016 at 14:45

1 Answer 1

0

Following might helpful.

    let tempImage: UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage
    let imagetoTransmit: UIImage = tempImage
    shootedImage = imagetoTransmit
    _ picker.dismissViewControllerAnimated(true, completion: {
        self.performSegue(withIdentifier: "cameraSegueIdent", sender: nil)
    })

Also, make sure that the segue identifier is correctly configured in your storyboard.

Sign up to request clarification or add additional context in comments.

1 Comment

tried like that, but that didn't solved the problem, anyway i figured out how to do it and Updated my Question. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.