我有ViewController1和ViewController2。当我单击ViewController1上的按钮时,应转到ViewController2,而按自定义后退按钮应返回到ViewController1,而无需重新加载ex的内容:-如果我在ViewController1的文本文件中键入内容,则应保持原样。
有谁知道解决方案吗?
最佳答案
viewcontoller1按钮单击代码...
@IBAction func Parsent(sender: AnyObject) {
let secondVC = self.storyboard?.instantiateViewController(withIdentifier: "Identifier" as! ViewController2
let navigationVC = UINavigationController(rootViewController: secondVC)
self.present(navigationVC, animated: true, completion: nil)
}
ViewController2按钮代码在这里。
@IBAction func Dismiss(sender: AnyObject) {
self.dismissViewControllerAnimated(true, completion: nil)
}