简体   繁体   English

启动 UIViewController 后无法返回

[英]Can not go back once I start UIViewController

I'm starting a new UIViewController with我正在开始一个新的UIViewController

let myViewController = MyViewController()
navigationController?.pushViewController(myViewController, animated: true)

But then on my MyViewController() I do not see the arrow to go back, what I'm missing?.但是在我的 MyViewController() 上,我没有看到返回的箭头,我错过了什么?。

I think that there are 2 solutions to go back.我认为有两种解决方案可以返回。

  1. You should use Navigation Controller.您应该使用导航控制器。
    • Then, make the RootViewController, and connect other ViewController to RootViewController by Seague.然后,制作 RootViewController,并通过 Seague 将其他 ViewController 连接到 RootViewController。
    • Then, pesent the ViewController by performSegue from the current ViewController(RootViewController).然后,通过 performSegue 从当前的 ViewController(RootViewController) 中调用 ViewController。

在此处输入图片说明

在此处输入图片说明

  1. You can also implement the back by NavItem.您也可以通过 NavItem 实现背面。

如果您不在 MyViewController 类中使用 init 方法,请使用故事板标识符加载 MyViewController()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我回到它时,UIViewController得到偏移 - UIViewController gets offset when I go back to it 转到UITableViewController后无法返回主UIViewController - Can not go back on main UIViewController after going to UITableViewController 如果我在UIViewController和UITabBar之间切换,则无法滚动回到顶部 - Can't scroll back to top, if I switch between UIViewController with UITabBar NSTimer,当我回到ViewController时不会启动 - NSTimer, wont start when i go back to the ViewController 如何在 Objective-C 中返回(currentView-2)UIViewController? - How to go back to (currentView-2) UIViewController in Objective-C? 从设置视图iOS返回时启动其他UIViewController - Launch different UIViewController when go back from settings view iOS 在应用程序的第一次运行(例如教程)期间,如何使 uiviewcontroller 仅可见一次? - how can I make the uiviewcontroller visible only once during first run of the app (e.g. tutorial)? ViewController只会加载一次,当我返回时应用崩溃,然后再次加载 - ViewController will only load once, app crashes when I go back then load it again 如何从根视图返回上一个视图? - How can I go back to the previous view from root view? 使用 UINavigation 保存后如何返回? - How can I go back after saving using UINavigation?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM