How can I add JPEGs to an asset catalog in Xcode? -


is possible add assets other png files xcode asset catalog?

when drag jpeg files asset catalog aren't accepted ui.

you can add non-png assets editing json representation of asset manually. easiest way copy existing asset , modify it:

  1. right click on existing asset , choose show in finder
  2. copy , paste existing .imageset item , rename it, e.g. my_image.imageset
  3. double-click new .imageset
  4. delete existing images in folder
  5. copy in jpeg files
  6. edit contents.json file, replacing values filename key jpeg filenames

your contents.json this:

{   "images" : [     {       "idiom" : "universal",       "scale" : "1x",       "filename" : "my_image.jpg"     },     {       "idiom" : "universal",       "scale" : "2x",       "filename" : "my_image@2x.jpg"     }   ],   "info" : {     "version" : 1,     "author" : "xcode"   } } 

be sure refer image name, without extension:

[uiimage imagenamed:@"my_image"] 

this approach work gifs , other assets copied app's main bundle @ build time. worth noting images end png extension when copied bundle, still load correctly.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -