Storyboard doesn't display assets after migrat

2019-07-19 11:16发布

After migrating image resources to an Asset Catalog the app builds and runs correctly but the assets don't show up in Xcode's storyboard.

enter image description here

2条回答
对你真心纯属浪费
2楼-- · 2019-07-19 11:42

I've encountered a similar problem that storyboard just not display the images I set in Asset.

But my case is a little bit different. And the answer is pretty simple.

I only drag one image to the image set and accidently put it to "3x" where storyboard would load "1x" from image set.

enter image description here

Hope this would help someone else and save their time. Don't make the silly mistake as I did.

查看更多
3楼-- · 2019-07-19 11:53

In my case this occurred because I used the full asset name including file extension (i.e. '.png') in Storyboard.

enter image description here

However, the name for the asset needs to match the name of the Image Set in the Asset Catalog:

enter image description here

So by removing '.png' from the image name in Storyboard it solved the problem.

查看更多
登录 后发表回答