Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add many images to xcodes asset catalog - how to manage naming and 1x,2x,3x for each?

Tags:

xcode

ios

xcasset

I have an app where I would like to add many images (500+) to xcode's asset catalog. Adding the 1x images was easy, I simply had to drag the first folder. However to add the 2x and 3x images it seems I would need to drag each image in manually, and I'd prefer not to do that. The 3 different sizes for each image are all named the same, w/ just different sizes. Is there anyway to automate this process?

like image 742
Dr. Zoidberg Avatar asked May 21 '16 04:05

Dr. Zoidberg


People also ask

What is 1x 2x and 3x in iOS?

1x, 2x, and 3x images allow developers and Apple to optimize app presentation based on the user's device, whether an entry-level iPhone or the most expensive iPad. Conceptually, 1x, 2x, and 3x images are the same image -- simply at different sizes.

Where do I put images in Xcode project?

To use images in Xcode, you need to upload them to Assets. xcassets , located in the Supporting Files folder. There are two options you can go with: bitmaps (aka . png files) or vectors (aka .


1 Answers

You can named image something like : yourimg.png, [email protected], [email protected] ,so it's become one set. Let's take another : dogImg.png, [email protected], [email protected] then this is second set.

So, you can name images like this and put every images to one single folder.

Then you simply drag and drop that folder to xcode, and you have done!

No need to use assets in this case! this naming conversion manage same as assetts.!

Refer Raywebderlich's one tutorial's portion where they are adding images like this.

OR (recommended way - because it is using assets)

Name your images like - [email protected], [email protected], [email protected] and drag all them in to the assets and it will automatically take place at proper location. That's it!!

You can maintain folder structure also. For example If you have folder structure like below screen shot,

enter image description here

and If you drag and drop whole Images folder to assets then xcode will manage everything for you(see result in below screenshot) but you just need to keep in mind that follow the naming standard for the images like [email protected], [email protected], [email protected]. You can ignore @ for 1x image, I mean your image set can be like test.png, [email protected], [email protected] also!

Screenshot of assets after dragging Images from the finder,

enter image description here

like image 133
Ketan Parmar Avatar answered Oct 29 '22 22:10

Ketan Parmar