Unwind Segue not working in iOS 8
ios 8 unwind 无效 push和modal被抛弃了,用什么替换? ps:开发工具xcode6.1 deployment Target:8.1
ios 8 unwind 无效 push和modal被抛弃了,用什么替换? ps:开发工具xcode6.1 deployment Target:8.1
2014-12-01
From: http://imtx.me/archives/1910.html
在 iOS 8 当中,很遗憾的,Unwind 不再像以前一样好好工作了:如果你的 ViewController 是基于NavigationController,那么现在它只支持同一层级的 ViewController 之间的相互跳转(即通过 Push 方式产生的),而不支持不同层级的 ViewController 之间的相互跳转了(即通过 Modal 形式产生)。
Apple 没有什么 Depcated 的 Warning,直接就让 Modal 形式的 ViewController 下执行 Unwind 不工作了,没有任何错误和提示…
关于这个,StackOverflow 上有一个讨论:Unwind Segue not working in iOS 8
目前为止,没有一个好办法(包括那个被接受的 Answer 实际上了不行),目前为止我发现最好的办法就是重写相关代码,然后用 delegate 去实现。如果你有更好的办法,请记得告诉我。
For Swift
CustomTabBarController.swift
Apple has FIXED this bug in iOS 8.1
Temporary solutions for iOS 8.0
The unwind segue will not work only in next situation:
View structure: UITabBarController -> UINagivationController -> UIViewController1 -> UIViewController2
Normally (in iOS 7, 8.1), When unwind from UIViewController2 to UIViewController1, it will call viewControllerForUnwindSegueAction in UIViewController1.
However in iOS 8.0 and 8.0.x, it will call viewControllerForUnwindSegueAction in UITabBarController instead of UIViewController1, that is why unwind segue no longer working.
Solution: override viewControllerForUnwindSegueAction in UITabBarController by create a custom UITabBarController and use the custom one.
举报