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:
- right click on existing asset , choose show in finder
- copy , paste existing
.imagesetitem , rename it, e.g.my_image.imageset - double-click new
.imageset - delete existing images in folder
- copy in jpeg files
- edit
contents.jsonfile, replacing valuesfilenamekey 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
Post a Comment