简体   繁体   中英

ios - What is the correct way to add outside files to my new project?

I have about 20 image files which I would like to a new project. I tried to make my code base clean so I made a group src/img where I intended to place the images.

Then I tried to copy the images via the file system, and obviously the groups that I made did not also create folders. So before I do anything that would dirty-up the code base, I wanted to ask here.

What is the correct way to add the files I want to add so they would render in my group under proj_name/src/img ?

Thanks!

You can first create a folder src/img inside your project in filesystem and copy all of your images in that folder. Then drag the whole img folder to your project in Xcode, but make sure you don't check copy files option when you drag. But, do select the option to create group so that image folder dragged is also a group in Xcode

The filesystem location is not represented by Xcode project groups.

The groups you are creating are supposed to be organized by you, but Xcode also provides useful options like automatically creating groups for the folders checkbox when you are adding new files to the project.

After the files are added to the project, you are free to "move" them to other groups or rename groups, that changes will be stored at the project bundle. Of course if you make the filesystem changes you'll have to remove the broken references from the project and recreate them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM