xcode 如何复制 .xib 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4190718/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:55:32  来源:igfitidea点击:

How to duplicate a .xib file?

objective-cxcodexib

提问by foreyez

I see there's no "duplicate" when I right click on a .xib. So is the way to do it: just to go to finder, copy the file to another name, and then drag it to my resources? Would that be all I'd need to do?

当我右键单击 .xib 时,我看到没有“重复”。这样做的方法是:只是转到finder,将文件复制到另一个名称,然后将其拖到我的资源中?这就是我需要做的全部吗?

[Note: just wondering if there's other files or settings I need to bother with.]

[注意:只是想知道是否还有其他文件或设置需要我处理。]

采纳答案by W Dyson

Yes, that's most of what's needed. Make sure to open the nib file and verify that the connections are as you want them to be. It will act like any file you duplicate. Just give it an original name and make sure it's saved in the correct folder before you import it into the project.

是的,这就是最需要的。确保打开 nib 文件并验证连接是否符合您的要求。它就像您复制的任何文件一样。只需给它一个原始名称,并确保在将其导入项目之前将其保存在正确的文件夹中。

回答by Ryan Heitner

The best way to do this is use cmd ? ,shift, s on the xib or storyboard. Then save it with a new name or location.

最好的方法是使用 cmd ?,shift, s 在 xib 或故事板上。然后使用新名称或位置保存它。

回答by Kasaname

yes , you can copy the the contents of the xib file by just (command+c) and paste it into another xib file by using (command +v) but by simply cop and pasting you won't get the references you need to go the properties in xib file there you need to give the class name for which you have created a new xib file and then it will give you the references.

是的,您可以仅通过 (command+c) 复制 xib 文件的内容,然后使用 (command +v) 将其粘贴到另一个 xib 文件中,但是通过简单的 cop 和粘贴,您将无法获得需要的引用xib 文件中的属性,您需要提供您为其创建新 xib 文件的类名,然后它将为您提供引用。