I have two view controllers.
The first one is embedded in a Navigation Controller . On the first view controller there is Bar Button Item which is connected by a segue to the second view controller. The segue is set as Push. Once I go to the second view controller there is a Bar Button Item which is an IBAction and should dismiss the page, but it doesn't.
Second View Controller Code:
import UIKit
class Page2ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func donePressed(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
}
Within your donePressed(_:)
function, access the navigation controller and call the popViewController(_:)
function.
@IBAction func donePressed(_ sender: Any) {
navigationController?.popViewController(animated: true)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.