[英]Unwind to a viewController that is not in the current navigation view controller chain
I have the following scenes in the storyboard
我在
storyboard
有以下场景
VC1 => NavC => VC2 => VC3 => VC4 I programmatically segue
from VC1 to either VC2 or VC3 based on a condition (I am doing that by instantiating NavC and change the viewControllers array). VC1 => NAVC => VC2 => VC3 => VC4予编程
segue
从VC1基于任一VC2或VC3上的条件(我这样做,通过实例NAVC和改变viewControllers数组)。 Now I would like to unwind from VC4 to VC1, but I think I am doing something wrong, because it is ignored and nothing is happening. 现在,我想从VC4放松到VC1,但是我认为我做错了什么,因为它被忽略了并且什么也没有发生。 To do this I have defined an
IBAction
called unwind1 in VC1, then I have created an exit segue
from VC4 to its exit and called it segue1. 为此,我在VC1中定义了一个名为unwind1的
IBAction
,然后创建了一个从VC4到其出口的出口segue
,并将其称为segue1。 I also have subclassed UINavigationController
and have the following methods in it: 我还
UINavigationController
并在其中包含以下方法:
override func viewControllerForUnwindSegueAction(action: Selector, fromViewController: UIViewController, withSender sender: AnyObject!) -> UIViewController {
return self.presentingViewController!
}
override func segueForUnwindingToViewController(toViewController: UIViewController, fromViewController: UIViewController, identifier: String?) -> UIStoryboardSegue {
return UIStoryboardSegue(identifier: identifier, source: fromViewController, destination: toViewController)
}
In method1 of VC4 I make a call to self.performSegueWithId("unwind1")
. 在VC4的method1中,我调用了
self.performSegueWithId("unwind1")
。 Although when I trace the execution control reaches to this line but it is ignored. 尽管当我跟踪执行控制到达此行时,它却被忽略了。 When I put breakpoint in the two above-mentioned methods, execution control never gets there.
当我在上述两种方法中设置断点时,执行控制就永远不会实现。 Any thoughts on what I am doing wrong?
对我在做什么错有任何想法吗?
It seems that what I have done is the correct solution to the problem, because I just noticed it works on ios 8.1, but it does not work on ios 8.0. 看来我所做的是对问题的正确解决方案,因为我刚刚注意到它在ios 8.1上有效,但在ios 8.0上却无效。 I assume it is a bug in the iOS!
我认为这是iOS中的错误!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.