
当开发程序页面太多,或多人合作,页面跳转过于繁琐...全部放在main.stroyboard中,画面会越来越复杂。它会迅速变的无法管理,阻碍你的进度。
为了解决这个问题,在 iOS 9 中苹果介绍了 Storyboard References 这个概念。Storyboard References 允许你从 segue 中引用其他 storyboard 中的 viewController。这意味中你可以保持不同功能模块化,同时 Storyboard 的体积变小并易与管理。不仅容易理解了,和团队一起工作时,合并(工作成果)也变的简单了。
选中想要分开的画面,可以选中一个viewcontroller,按住shif选中多个,点击 Xcode 的菜单栏,选择"Editor->Refactor to Storyboard"。

系统会新建一个storybord,给它重命名eg Exchange.storyboard
回到main.storyboard中,你会发现系统给你自动添加了一个图标,如图,Storyboard Reference

当然,你也可以手动添加Storyboard Reference控件,方法和其他控件一样,托到storyboard中就行,
只是要给Storyboard Reference指定想要跳转的场景

首先得想新建一个storyboard,eg Exchang.storyboard。
然后,选中跳转的按钮,按住 Control 健和鼠标左键,拖拽到 storyboard reference上,这样就创建了一个 segue。
最后,当在main中拖拽了一个Storyboard Reference,
在storyboard的属性中选中Exchang,这样storyboard就和空间绑定了。

网友评论