내 문제는 언 와인드 프로세스가 뒤로 단추를 클릭 할 경우에도 트리거되지 않는 것입니다.
내 코드
나는 2ndViewController에 사용자 정의 SEGUE를 사용하는 클래스 1stViewController 있습니다. 내 2ndViewController에서
override func perform() {
let sourceVC = self.source as! 1stViewController
let destinationVC = self.destination as! 2ndViewController
sourceVC.addChildViewController(destinationVC)
sourceVC.view.addSubview(destinationVC.view)
}
난 다시 1stViewController에 풀기 SEGUE를 트리거 버튼을 추가 한 : 사용자 정의 SEGUE는 다음과 같습니다. unwinding segue는 2ndViewController의 unwind segue triggering exit 식별자를 통해 연결됩니다. 언 와인드 SEGUE 출구가 연결된 따라서, I는 IBAction를 생성했다 :
I 버튼의 동작 기능에 사용되는 것과 동일한 풀림 SEGUE의 식별자를 설정@IBAction func unwindToFeed(segue: UIStoryboardSegue) {}
func handleActionBackButton(){
print("here")
self.performSegue(withIdentifier: "unwindId", sender: self)
}
"여기"는 버튼을 클릭 할 때 인쇄되지만 performSegue는 그렇지 않은 것처럼 보입니다.
나는 나뿐만 아니라 사용자 정의 unwindSegue 클래스를 필요가 있다고 추측, 그래서 나는 unwindSegueEventToFeed 생성 :class unwindSegueEventToFeed: UIStoryboardSegue {
override func perform() {
let sourceVC = self.source as! 2ndViewController
let destinationVC = self.destination as! 1stViewController
let sourceView = sourceVC.view as UIView!
let destView = destinationVC.view as UIView!
let window = UIApplication.shared.keyWindow
window?.insertSubview(destView!, aboveSubview: sourceView!)
sourceVC.dismiss(animated: false, completion: nil)
}
} ... 2ndViewController에서 호출됩니다
override func segueForUnwinding(to toViewController: UIViewController, from fromViewController: UIViewController, identifier: String?) -> UIStoryboardSegue? {
return unwindSegueEventToFeed(identifier: identifier, source: fromViewController, destination: toViewController)
}
모든 단서에를 풀어내는 과정을 시작하기 위해 내가해야 할 일은 무엇입니까?
그냥 확인하려면 'unwindToFeed'가 1stViewController에 있습니까? – Paulw11
unwindToFeed가 2ndViewController에 있습니다. –
그 위치가 잘못되었습니다.unwind 메소드가 풀려있는 뷰 컨트롤러에서 * – Paulw11