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?
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.
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 .
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,
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,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With