我如何清理UINavigationBar过渡历史记录?

时间:2018-01-18 21:57:43

标签: ios swift uitableview uinavigationcontroller segue

我目前有父母"菜单" TableView UINavigationBar cell reference outlet Views Viewbuttons到3个类似Views的不同信息。

在每个button中,有View到其他2 View

每个UINavigationBar的segue会打开另一个back button

问题: 从每个View back button' Bar Button Item返回我之前的UINavigationController,但我尝试将cd C:\Users\%username%\AppData\Local\Apps\2.0\V7MK47Q8.0NZ\KLJLETPC.4RJ\micr..tion_d8f8f667ee342b5c_0010.0000_6b4a13fd451b1c00 Import-Module .\CreateExoPSSession.ps1 Connect-EXOPSSession -UserPrincipalName name@domain.com设置为" menu" 。

其他var ref = firebase.database().ref().child("datos").child("pedidos").child("nuevos"); 及其中的segue效果非常接近,但是segue动画与tell application "Finder" set theFile to some file of folder "Macintosh HD:Users:user:Desktop:lv:" end tell set randomImage to POSIX file theFile tell application "Messages" set targetBuddy to "appleid@mac.com" set targetService to id of 1st service whose service type = iMessage set textMessage to randomImage set theBuddy to buddy targetBuddy of service id targetService send textMessage to theBuddy end tell 中的动画不同。

如何清除segue中的UINavigationBar转换历史到初始视图?

2 个答案:

答案 0 :(得分:1)

您可以尝试弹出到根视图控制器,或者您可以编辑导航控制器viewControllers属性并删除/添加一些VC。

您也可以尝试Unwind Segue机制。

答案 1 :(得分:1)

以下是导航控制器提供弹出操作的一些方法(功能)。他们从弹出的导航堆栈返回可选的UIViewController(intance)。

open func popViewController(animated: Bool) -> UIViewController? // Returns the popped controller.

open func popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]? // Pops view controllers until the one specified is on top. Returns the popped controllers.

open func popToRootViewController(animated: Bool) -> [UIViewController]?

以下示例代码作为查询的解决方案::

// if you want to back to root of your app
if let rootNavigationController = self.window?.rootViewController as? UINavigationController {
     rootNavigationController.popToRootViewControllerAnimated(true)
}

// But if you want to back to root of your current navigation 
if let viewcontroller = self.storyboard?.instantiateViewController(withIdentifier: "NewViewController") as? NewViewController { // or instantiate view controller using any other method
     viewcontroller.navigationController?.popToRootViewControllerAnimated(true)
}