I've been at this problem for a few days can't crack it. Here is an overview for context.
User starts at HomeViewController
which is a tabbed view. Tap button activates segue to SketchViewController
which is not tabbed. User sketches an image. User taps Done button to indicate sketch is finished. Image is saved to small, hidden, UIImageView
on SketchViewController
. I want to pass this image to HomeViewController, where it will be used.
Here is the SketchViewController
where the image starts:
class SketchViewController: UIViewController {
@IBOutlet weak var SketchHiddenImage: UIImageView!
@IBAction func DoneButtonTapped(sender: AnyObject) {
//screenshot taken which results in the following
SketchHiddenImage.image = image
}
// Pass image to HomeViewController
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "toTabController" {
let tabbar: UITabBarController = segue.destinationViewController as! UITabBarController
let DestViewController: HomeViewController = tabbar.viewControllers?.first as! HomeViewController
DestViewController.sketchImage = SketchHiddenImage.image
}
}
Here is the HomeViewController where I want the image to end up:
class AskViewController: UIViewController {
@IBOutlet weak var HiddenTransferImage: UIImageView!
var sketchImage = UIImage!()
}
I have a storyboard "show
" segue from SketchViewController
to TabViewController
with identity "toTabController
".
I have seen all of the other similar posts, but this situation has a few complications for example the TabBarController
and no amount of amalgamation and manipulation of those other posts has helped me fix this so far. Anyways, thank you for the guidance.