gpt4 book ai didi

iphone - iOS - 如何初始化 UINavigationController 以显示推送的 ViewController?

转载 作者:可可西里 更新时间:2023-11-01 06:23:43 34 4
gpt4 key购买 nike

我想知道如何初始化 UINavigationController 以便在堆栈中显示第三个 View Controller ?有点像邮件应用程序。即使您终止了该应用程序,当您启动它时,您也会看到包含所有邮件的 View Controller 和“后退”按钮,可让您返回邮箱列表。

感谢您的回答。

最佳答案

您可能需要查看 UINavigationControllersetViewControllers:animated: 方法:

Parameters

viewControllers

The view controllers to place in the stack. The front-to-back order of the controllers in this array represents the new bottom-to-top order of the controllers in the navigation stack. Thus, the last item added to the array becomes the top item of the navigation stack.

animated

If YES, animate the pushing or popping of the top view controller. If NO, replace the view controllers without any animations.

Discussion

You can use this method to update or replace the current view controller stack without pushing or popping each controller explicitly. In addition, this method lets you update the set of controllers without animating the changes, which might be appropriate at launch time when you want to return the navigation controller to a previous state.

If animations are enabled, this method decides which type of transition to perform based on whether the last item in the items array is already in the navigation stack. If the view controller is currently in the stack, but is not the topmost item, this method uses a pop transition; if it is the topmost item, no transition is performed. If the view controller is not on the stack, this method uses a push transition. Only one transition is performed, but when that transition finishes, the entire contents of the stack are replaced with the new view controllers. For example, if controllers A, B, and C are on the stack and you set controllers D, A, and B, this method uses a pop transition and the resulting stack contains the controllers D, A, and B.

Availability

Available in iOS 3.0 and later.

UINavigationController Class Reference

关于iphone - iOS - 如何初始化 UINavigationController 以显示推送的 ViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9428318/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com