ios 我可以将故事板从一个项目复制到另一个项目吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20452466/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I copy a storyboard from one project to another project?
提问by 001
To reuse a storyboard, could I simply copy it from one project to another project (then make modification to the storyboard as required)?
要重用情节提要,我是否可以简单地将其从一个项目复制到另一个项目(然后根据需要对情节提要进行修改)?
采纳答案by MuhammadBassio
Yes you can, just make sure they are selected as your main storyboards as per image below.
是的,您可以,只需确保按照下图选择它们作为您的主要故事板。
回答by cojoj
As @Muhammad said you can and it is very simple!
正如@Muhammad 所说,您可以,而且非常简单!
- You just have to drag the Storyboard file from one project to another and select all options (The same procedure as importing anything else!).
- Next, you just need to go to your project options by clicking on the project icon in the left upper side of project navigator.
- Then you just need to select this storyboard to be your storyboard and that's it.
- 您只需将 Storyboard 文件从一个项目拖到另一个项目并选择所有选项(与导入其他任何内容的过程相同!)。
- 接下来,您只需单击项目导航器左上角的项目图标即可转到您的项目选项。
- 然后你只需要选择这个故事板作为你的故事板,就是这样。
回答by Suragch
Method 1
方法一
Select the View Controller in the storyboard and press Command+ Cto copy. Then press Command+ Vto paste in the second storyboard. Check the document outline to see where it was pasted to.
在 storyboard 中选择 View Controller,然后按Command+C复制。然后按Command+V粘贴第二个故事板。检查文档大纲以查看其粘贴到的位置。
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:
在 Project Navigator 中右键单击故事板文件,然后选择 Open As > Source Code。向下滚动 XML 代码,直到找到您的视图控制器。它看起来像这样:
<!--My View Controller-->
<scene sceneID="tne-QT-ifu">
...
</scene>
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.
- 当然,您还必须复制视图控制器 swift 文件,但不需要重新连接插座。
回答by Muhammad Zaheer
It's simple. Just follow these steps:
这很简单。只需按照以下步骤操作:
- Press cmd + D while selecting your desired storyboard scene. It will create a duplicate copy of your selected scene.
- Press cmd + x to cut the scene from the existing project.
- Press cmd + v into the storyboard section of the second project.
- 在选择所需的故事板场景时按 cmd + D。它将创建所选场景的副本。
- 按 cmd + x 从现有项目中剪切场景。
- 按 cmd + v 进入第二个项目的故事板部分。
Cheers.
干杯。