问题
Does any one know how to add GIF image files to an Asset Catalog in XCode5?
回答1:
Go to your Images.xcassets folder and create a folder named MyGifAnimation.xcassets, then put your MyGifAnimation@2x.gif 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": "MyGifAnimation@2x.gif"
}],
"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.
来源:https://stackoverflow.com/questions/19462747/how-to-add-gif-images-to-asset-catalog-in-xcode5