The Contents.json describing the image set "BG_Email_Textfield.imageset" must start with a top level

来源:互联网 发布:蓝格眼镜软件 编辑:程序博客网 时间:2024/05/17 23:37

If you use Xcode to add a single image to your project as an image set, Xcode creates a subdirectory containing two files- the image and a Contents.json file. You can see this in Finder. In your Xcode project directory open Images.xcassets. For example Images.xcassets could have a subdirectory myImage.imageset with myImage.png and a Contents.json similar to

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

You can specify another image for 2x resolution. If your project does not contain a directory and Contents.json file similar to this, it may be easiest to use Xcode to add the image set. In Xcode project navigator, if you select Images.xcassets a pane appears with a small "+" at the bottom to "add a group or image set".

References
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/AddingImageSets/AddingImageSets.html
https://www.iphonelife.com/blog/31369/unleash-your-inner-app-developer-managing-images-xcode-5-asset-catalogs

0 0
原创粉丝点击