In first view controller we have two buttons
if we tap on first view controller oneButn i need to hide onebutnContainerView in secondview controller
if we tap on first view controller secndButn i need to hide twobutnContainerView in secondview controller
in first view controller viewController.oneButnContainerView.isHidden = true getting error:
Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
first view controller code:
class firstViewController: UIViewController{
@IBAction func oneButn(_ sender: UIButton) {
self.view.endEditing(true)
let viewController = self.storyboard?.instantiateViewController(withIdentifier: "NewZoomAddressViewController") as! NewZoomAddressViewController;
viewController.delegate = self
viewController.oneButnContainerView.isHidden = true
viewController.twobutnContainerView.isHidden = false
self.navigationController?.pushViewController(viewController, animated: true);
}
@IBAction func secndButn(_ sender: UIButton) {
self.view.endEditing(true)
let viewController = self.storyboard?.instantiateViewController(withIdentifier: "NewZoomAddressViewController") as! NewZoomAddressViewController;
viewController.delegate = self
viewController.oneButnContainerView.isHidden = false
viewController.twobutnContainerView.isHidden = true
self.navigationController?.pushViewController(viewController, animated: true);
}
}
I have outlets for two views in Second view controller
@IBOutlet weak var oneButnContainerView: UIView!
@IBOutlet weak var twoButnContainerView: UIView!
how to hide seconviewcontroller view in firstviewcontroller