开发者

How to copy a XIB to another project?

开发者 https://www.devze.com 2023-01-18 04:33 出处:网络
Simple.I have two projects in Xcode.In one of them I made a .xib file and I want to copy it to another project, so as to save some time redoing it.

Simple. I have two projects in Xcode. In one of them I made a .xib file and I want to copy it to another project, so as to save some time redoing it.

I can't drag it to the other project, nor do copy/paste by command, nor cop开发者_运维知识库y/paste by the Edit menu.

Any suggestions?


Go into finder, find the .xib file and copy it to the directory of the second project. Then uses add existing files to add it to the second project.


Just drag and drop from one project window to the other.

Make sure that you check the "Copy items to the destination folder"

If you have more than one targets make sure that you check the appropriate target when you add it.

You probably have to reconnect all of your outlets, and if it crashes for some reason it means that there are connected outlets/actions which are not available in your code.


Here is how I managed to do this with XCode 10.2.1

  1. Close the XCode project with the xib file you want to copy.
  2. Drag the xib file from finder over to the new project. Make sure you tick the copy items if needed box.
  3. If the xib file uses images for outlets, also drag the images to the new project.

There is no need to reconnect the outlets.

0

精彩评论

暂无评论...
验证码 换一张
取 消