但是,根据呈现控制器,我希望游戏处于不同的“模式”(即:多人游戏,单人游戏等).我正在尝试添加一个再次播放按钮,该按钮可以展开前一个视图控制器,但是当用户可以使用多个路径进入此视图时,我不确定如何展开.
换句话说,我的应用程序有点:
A – > B – > C或
A – > D – > C其中C可以(理想地)展开到D或B.
我想知道实现这个的最佳方法是什么?我应该将所有视图控制器嵌入导航控制器吗?或者有没有办法根据某种条件呈现某个视图控制器?感谢您的任何帮助!
解决方法
Starting from the view controller that initiated the unwind segue the
search order is as follows:
The next view controller in the responder chain is sent a
viewControllerForUnwindSegueAction:fromViewController:withSender:
message. For a view controller presented modally,this will be the
view controller that called
presentViewController:animated:completion:
. Otherwise,the
parentViewController.The default implementation searches the
receiver’schildViewControllers
array for a view controller that wants
to handle the unwind action. If none of the receiver’s child view
controllers want to handle the unwind action,the receiver checks
whether it wants to handle the unwind action and returns self if it
does. In both cases,the
canPerformUnwindSegueAction:fromViewController:withSender:
method is
used to determine if a given view controller wants to handle the
unwind action.If no view controller is returned from
viewControllerForUnwindSegueAction:fromViewController:withSender:
in
step one,the search repeats from the next view controller in the
responder chain.
因此,精确的过程将取决于您如何呈现视图控制器C – 例如,通过UINavigationController上的模态演示segue或push segue,但只要B和D都实现了展开动作,您应该是好的.