如果文本框值等于 nil,我想取消展开转场。下面是当前的代码。我使用故事板连接保存按钮(将文本值保存到数据库中)。我正在考虑使用 poptorootviewcontroller 确保教科书在执行转场之前具有值。他们有什么方法可以用当前的代码来做到这一点吗?
mainView 内部的代码可以恢复到-
@IBAction func unwind(_ segue: UIStoryboardSegue){
print("Back in TableView")
}
Run Code Online (Sandbox Code Playgroud)
childView 上的按钮执行 unwind segue-
@IBAction func saveAddress(_ sender: UIButton) {
// save values to dictionary save dictionary to firebase under user, uid, addresses
// uialert controller if fields are not completed do not allow segue if fields are not complete
// perform segue to addresstableview
let addy1: String = address1Txt.text!
let addy2: String = address2Txt.text!
let aptNum: String = aptTxt.text!
let city: String = cityTxt.text! …Run Code Online (Sandbox Code Playgroud)