Move or copy view controller from one storyboard to another

前端 未结 9 831
暖寄归人
暖寄归人 2021-01-30 19:46

I have several UIViewControllers in one Storyboard. Now I want to move some UIViewControllers to another Storyboard. Is it possible?

相关标签:
9条回答
  • 2021-01-30 20:07

    It is possible to copy, but you have to open both storyboards at once in one project, and then copy and paste.

    0 讨论(0)
  • 2021-01-30 20:11

    I have came up to a similar situation, where in my Main storyboard I have too many scenes and need to refactor. The idea that I had in the beginning was to mark several and do copy paste as suggested by many. However, I was concerned for any resolution of storyboard connections to the view controllers code. After much searching I found that since iOS 9 there is a new feature available to "Refactor to Storuboard". You may mark several scenes in your source storyboard and you can select from the Editor menu that option. Then all selected scenes are extracted from your old storyboard, a new storyboard is created as well as a link to that in the old/main storyboard. Useful totorials are: https://code.tutsplus.com/tutorials/ios-9-staying-organized-with-storyboard-references--cms-24226 https://www.raywenderlich.com/115697/ios-9-storyboards-tutorial-whats-new-in-storyboards

    I hope that this new official storyboard refactoring functionality can provide a better solution to this kind of problems.

    0 讨论(0)
  • 2021-01-30 20:20

    Copy-paste (Command+C, Command+V) works fine but remember to resolve outlet connections because Xcode seems to keep the original connections: close/reopen project, delete what's wrong and reestablish missing connections.

    0 讨论(0)
提交回复
热议问题