Can I copy a storyboard from one project to another project?

前端 未结 4 411
情歌与酒
情歌与酒 2020-12-30 23:02

To reuse a storyboard, could I simply copy it from one project to another project (then make modification to the storyboard as required)?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 23:50

    Method 1

    Select the View Controller in the storyboard and press Command + C to copy. Then press Command + V to paste in the second storyboard. Check the document outline to see where it was pasted to.

    Method 2

    Right click the storyboard file in the Project Navigator and select Open As > Source Code. Scroll down the XML code until you find your View Controller. It will look something like this:

    
    
        ...
    
    

    Copy this and paste it in the second project's storyboard file.

    Notes

    • You must also copy over the view controller swift file, of course, but the outlets shouldn't need to be reconnected.

提交回复
热议问题