在项目中添加多个故事板 - Swift

问题描述 投票:0回答:1

如何使用 Swift 在同一项目中创建多个故事板?我知道我必须转到“文件”->“新建”->“文件”,然后选择 Storyboard,但如何将该 Storyboard 集成到我的项目中并在 Swift 代码中导航到新 Storyboard 的视图?

swift xcode storyboard
1个回答
2
投票

您需要获取所需故事板的参考

let aStoryboard = UIStoryboard(name: "storyboardName", bundle: nil)

然后实例化所需的视图控制器

let vc = aStoryboard.instantiateViewControllerWithIdentifier("viewControllerIdentifier") as! UIViewController
© www.soinside.com 2019 - 2024. All rights reserved.