I'm new to this so bear with me please. I have a Master-Detail app and am having issues when running the app in Portrait iPad. Master shows a table view, that when cell is clicked on, an image shows up on the Detail page. It's crashing on the imageView1.image = MasterViewController.MyVariables.flowerImage! Note that this works in iPhone. I think what's happening is because the flowerImage has not yet loaded so there is no value. By the way, the error is: fatal error: unexpectedly found nil while unwrapping an Optional value.
override func viewDidLoad() {
super.viewDidLoad()
imageView1.image = MasterViewController.MyVariables.flowerImage!
// Do any additional setup after loading the view, typically from a nib.
configureView()
}
Code for SplitViewController:
import UIKit
class SplitViewController: UISplitViewController, UISplitViewControllerDelegate {
override func viewDidLoad() {
self.delegate = self
self.preferredDisplayMode = .allVisible
}
func splitViewController(
_ splitViewController: UISplitViewController,
collapseSecondary secondaryViewController: UIViewController,
onto primaryViewController: UIViewController) -> Bool {
// Return true to prevent UIKit from applying its default behavior
return true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}