Does any one know how to add GIF image files to an Asset Catalog in XCode5?
If you don't already have an asset catalog in your project, you can create one by right-click on your project and choosing New File. From "iOS" choose "Resource" then Asset Catalog, then click Next and name your catalog. You can now select your new asset catalog in Xcode, and drag pictures directly into it.
Go to your Images.xcassets folder and create a folder named MyGifAnimation.xcassets, then put your [email protected] and MyGifAnimation.gif files in it. After that, create a Contents.json file. Open that with your favorite text editor and write the following in it:
{
"images": [{
"idiom": "universal",
"scale": "1x",
"filename": "MyGifAnimation.gif"
}, {
"idiom": "universal",
"scale": "2x",
"filename": "[email protected]"
}],
"info": {
"version": 1,
"author": "xcode"
}
}
You'll have to handle the animation yourself as loading it directly to a UIImageView won't result in an animated gif.
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