我有三个View Controller,并且希望从第三个单击按钮返回到第一个。我执行以下操作:
doneButton.addTarget(self, action: #selector(ThirdViewController.doneButtonPressed(_:)), for: .touchUpInside)
@IBAction func unwindFromNewSubscription(segue: UIStoryboardSegue) {
}
@IBAction func doneButtonPressed(_ sender:UIButton!) {
print("DONE BUTTON PRESSED")
performSegue(withIdentifier: "changeFromNewToMain", sender: self)
}
并且它起作用了,但是当我在V3中点击按钮时,它立即消失了,我看到了动画:V2向下滑动,所以最终我可以看到V1。但是我想让V3动画下来而不是消失后再看V1。有任何解决办法的想法吗?
(V1,V2,V3-View Controller 1、2、3)
答案 0 :(得分:1)
尝试在// Loop through all list items, and hide those who don't match the search query
for (i = 0; i < li.length; i++) {
a = li[i];
if (a.innerText.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
动作中使用presentingViewController?.dismiss(animated: true, completion: nil)
,而不要调用@IBAction func doneButtonPressed(_ sender:UIButton!)
。