Is it possible to add images automatically to project from local folder?
I am new to iPhone. What I did is creating a local folder named images
and add images one by one as UIImage imageNamed:@"image.jpg"
. Instead of adding them one by one, is there any way to add images automatically to project from local folder? When I place any new image in t开发者_StackOverflow中文版he folder, it should be automatically added to the project bundle. How can I do this? Please help me.
Remove the individual images from your project's resources. Now do Add -> Existing Files... and select the folder that contains your images.
In the dialog that comes up, select "Create Folder References for any added folders". This will add the entire folder as a resource within your project. Now when you add any files to that folder, they'll automatically be installed as resources within your app. You'll no longer need to add each file individually.
Note: This installs the entire directory structure within your resources folder, so you'll need to change your code to load the files from the appropriate subdirectory.
精彩评论