简体   繁体   English

如何将 go 从 SwiftUI 视图转换为 UIKit TabViewController?

[英]How do I go from a SwiftUI view to a UIKit TabViewController?

I want to know how I can go from a SwiftUI View into a specific view controller that is part of a tab bar controller. I want to go from a SwiftUI view to a specific index in the UITabBarController which are the UIKit View Controllers.我想知道我如何能从882228466595988观看到特定视图controller的883306030677488,它是tab bar controller的一部分。 (Let's assume the first index) - Is this possible? (让我们假设第一个索引) - 这可能吗?

Because of view hierarchy and how they are loaded, you are going to run into a couple issues if you load a SwiftUI view, then segue to a SwiftUI tab view (Tab Views like to be the parent view) It is possible though!由于视图层次结构及其加载方式,如果加载 SwiftUI 视图,然后转到 SwiftUI 选项卡视图(选项卡视图喜欢作为父视图),您将遇到几个问题,但这是可能的!

First, make sure your first view is wrapped in a navigation view.首先,确保您的第一个视图包含在导航视图中。 Then when it is time to switch to the tab bar view, either activate a navigation link or make sure the button the user taps is wrapped in a Navigation Link.然后,当需要切换到选项卡栏视图时,要么激活导航链接,要么确保用户点击的按钮包含在导航链接中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM