在 Swift 中添加故事板

Add storyboard in Swift

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

您需要获得对所需故事板的引用

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

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

let vc = aStoryboard.instantiateViewControllerWithIdentifier("viewControllerIdentifier") as! UIViewController