私はView Controllerを展示しているCustom Segueを持っていて、対応するCustom Unwind Segueを持っています。このコードはiOS 8で正常に機能し、UIStoryboardSegueのサブクラスを生成し、performメソッドを実装することで実装されています。その後、私は私のカスタムiOSの9のナビゲーションコントローラiOS 9のsegueForUnwindingToViewController
func segueForUnwindingToViewController(toViewController: UIViewController, fromViewController: UIViewController, identifier: String) -> UIStoryboardSegue {
var segue: UIStoryboardSegue
if (fromViewController is MyViewController.self) {
segue = CustomSegue(identifier: identifier, source: fromViewController, destination: toViewController)
//Custom Unwind Segue
}
else {
var unwindSegue: UIStoryboardSegue = super.segueForUnwindingToViewController(toViewController, fromViewController: fromViewController, identifier: identifier)
//Normal Unwind Segue
segue = unwindSegue
}
return segue
}
に次のメソッドをオーバーライドし、segueForUnwindingToViewControllerが推奨されていません。それはMyViewController CustomSegueでもまだ動作します。ただし、デフォルトのunwind segueは、他のunwind segueでは機能しません。スーパーでメソッドを呼び出すと、巻き戻しセグが返されますが、segueは決して発生せず、ビューコントローラーはポップされず、ユーザーは決して前の画面に戻ることはできません。だから、私が通常のショーセグを使用すると、対応するアンワインドセグは廃止されたメソッドを呼び出します。このメソッドはスーパーメソッドを呼び出し、動作しません。