我设置了一个按钮来保存更改。然后,它选择了视图控制器,但是由于某种原因又选择了选择。
// This all happening in View Controller A.
@IBAction func saveChangesPressed(_ sender: UIButton) {
let usersRef = ref?.child("Users")
let queryRef = usersRef?.queryOrdered(byChild: "username")
queryRef?.observeSingleEvent(of: .value, with: { (snapshot) in
for snap in snapshot.children {
let userSnap = snap as! DataSnapshot
let thechild = userSnap.key
let values = ["FirstName": self.firstName.text!, "LastName": self.lastName.text!, "address1": self.addressOne.text!, "address2": self.addressTwo.text!, "city": self.custCityText.text!, "zip": self.custZipText.text!, "phone": self.custPhoneText.text!]
self.ref?.child("Users").child(thechild).updateChildValues(values)
self.performSegue(withIdentifier: "View Controller B", sender: self)
}
})
}
我希望这能根据我正在调用的命令返回到View ControllerB。它会执行此操作,但是随后会选择回我开始的View ControllerA。我没有其他segues设置。另外,如果我删除了segue,则视图控制器A会像对其本身进行segue一样重新加载自身。