I am trying to take a photo, resize it and then tap "Use Photo" and switch over to a new view that displays both, the original image and edited image. My trouble is having the new view display after tapping "Use Photo". With my current code, I can dismiss the ImagePickerController just fine but then it goes back to the main view and then I get a black screen.
@IBAction func pickerButton(button: UIButton)
{
var controller : UIImagePickerController = UIImagePickerController();
controller.delegate = self
//controller.allowsEditing = true
self.presentViewController(controller, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject])
{
var mediaDictionary : NSDictionary = info as NSDictionary
println("here it comes")
var pickerMedia : String = mediaDictionary.objectForKey("UIImagePickerControllerMediaType") as! String
dump(pickerMedia)
if (pickerMedia == "public.image"){
///////Loading dictionaries for value pairs that don't exist as of video capture video
var anImage : UIImage = mediaDictionary.objectForKey("UIImagePickerControllerOriginalImage") as! UIImage
/////////Optional for edited image
var editedImage : UIImage = mediaDictionary.objectForKey("UIImagePickerControllerEditedImage") as! UIImage
// Dismiss the image picker
picker.dismissViewControllerAnimated(true, completion: nil)
// Here is my issue...
var svc : decisionController = decisionController()
self.presentViewController(svc, animated: true, completion: nil)
}
My decisionController View is in a separate swift file and it is in my storyboard. It has the class set to decisionController. I would normally create a segue into my next view but I don't have a button to reference to since Im using a generic UIImagePickerController.
Here is my decisionController.swift
import UIKit
class decisionController: UIViewController {
@IBOutlet var anImageView : UIImageView?
@IBOutlet var anotherImageView : UIImageView?
override func viewDidLoad() {
super.viewDidLoad()
//anImageView!.image = anImage
//anotherImageView!.image = editedImage
// Do any additional setup after loading the view, typically from a nib.
}
}