简体   繁体   中英

How to use images in subfolders in iOS Interface Builder

I have an iOS project that uses a bunch of images in a single UIView

I have created the view in Interface Builder in put it all the appropriate subview (UIImageViews, UIButton, etc)

I want to use an image in my project's resources in the IB, but IB only seems to know about images that were added explicitly. If I add a whole folder to the resources in XCode, IB doesn't know about them,

However, if I drag the files themselves in, IB will find them.

The problen is, I have all my images arranged nicely in folders, and I don't want to have to drag each new image into XCode. XCode even has an option to create folder references that will load anything in those folder automatically. 在此处输入图像描述 How do I get IB to work with images added that way?

Put the folder with your images into your project folder, then drag your folder into xcode. When it asks if you want to add them to the folder make sure you UNCHECK copy items into destination group's folder, as you have already put them there. That should keep your subfolder organization and give you access to all the files.

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