carbonr
carbonr

Reputation: 6067

How to add GIF images to Asset Catalog in XCode5

Does any one know how to add GIF image files to an Asset Catalog in XCode5?

Upvotes: 7

Views: 6906

Answers (1)

isair
isair

Reputation: 1860

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.

Upvotes: 8

Related Questions