Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift2 展开序列与popViewControllerAnimated_Swift2_Unwind Segue_Popviewcontrolleranimated - Fatal编程技术网

Swift2 展开序列与popViewControllerAnimated

Swift2 展开序列与popViewControllerAnimated,swift2,unwind-segue,popviewcontrolleranimated,Swift2,Unwind Segue,Popviewcontrolleranimated,我有一个连接到多个ViewController的mapview 我需要从另一个按钮(而不仅仅是后退按钮)实现“放松”,因此我使用: self.navigationController?.popViewControllerAnimated(true) 我的问题是:在上述工作过程中,我是否应该尝试在代码中使用父视图控制器中的prepareForUnwind和canPerformUnwindSegueAction,并从viewController中按住ctrl键拖动以退出情节提要?如果是,原因是什么

我有一个连接到多个ViewController的mapview

我需要从另一个按钮(而不仅仅是后退按钮)实现“放松”,因此我使用:

self.navigationController?.popViewControllerAnimated(true)

我的问题是:在上述工作过程中,我是否应该尝试在代码中使用父视图控制器中的
prepareForUnwind
canPerformUnwindSegueAction
,并从viewController中按住ctrl键拖动以退出情节提要?如果是,原因是什么?

基本上,如果您只是
缩小显示的
UIViewController
或从导航堆栈中弹出
UIViewController
,则不需要使用展开分段,尽管对您来说也是如此

但请考虑这样一种情况,即存在
UINavigationControllers
a、B、C,然后是
RootViewController
R

然后考虑一个条件

 (Present) R -> A
 (Push) AR -> XVController
 (Push)XVController -> B
 (Present)BR-> YVContoller
...and so on..
现在,如果您想返回到刚刚启动的项目RootViewController的YVController。无法将
popToRootViewController
弹出到B
UINavigationController的导航堆栈中。现在您要做的是..使用委派或更改窗口RootViewController,这不是一个好主意


因此,您需要使用unwind segue来克服此问题。。演示使用它的功能的示例。

基本上,如果您只是
缩小显示的
UIViewController
或从导航堆栈中弹出
UIViewController
,则不需要使用展开段,尽管它对您也有相同的作用

但请考虑这样一种情况,即存在
UINavigationControllers
a、B、C,然后是
RootViewController
R

然后考虑一个条件

 (Present) R -> A
 (Push) AR -> XVController
 (Push)XVController -> B
 (Present)BR-> YVContoller
...and so on..
现在,如果您想返回到刚刚启动的项目RootViewController的YVController。无法将
popToRootViewController
弹出到B
UINavigationController的导航堆栈中。现在您要做的是..使用委派或更改窗口RootViewController,这不是一个好主意

因此,您需要使用unwind segue来克服此问题。。演示使用它的能力的示例