您必須添加線在圖像的JSON文件。請遵循以下步驟:
1.右鍵單擊images.xcassets中設置的圖像,單擊查找器中顯示。
2.您將看到Contents.json文件,打開該文件,並添加如下代碼:
{
"idiom" : "iphone",
"filename" : "iphone-5.png",
"subtype" : "retina4",
"scale" : "2x"
},
所以你最終的JSON文件看起來像下面這樣:
{
"images" : [
{
"idiom" : "iphone",
"filename" : "iphone-4-normal.png",
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "iphone-4-ratina.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "iphone-5.png",
"subtype" : "retina4",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "iphone-6+.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
3.保存文件並關閉它。現在在你的Xcode中會有4個子圖像集,你可以在那裏拖動相應的圖像。
檢查此鏈接:http://www.intertech.com/Blog/xcode-assets-xcassets/ – vijay