Asset catalog vs folder reference: When to use one or the other?

后端 未结 2 631
有刺的猬
有刺的猬 2021-02-15 00:32

I can put files into Assets.xcassets or I can put files into folder references (the blue folders). When would I choose one over the other?

2条回答
  •  有刺的猬
    2021-02-15 00:58

    You should use Assets. Many benefits the folder references can't do

    1) Change color of image without any code

    2) Support vector, pdf better.

    3) Support Slicing image.

    4) Manage resource easier for autolayout. If your resources has 1x, 2x, 3x and ipad image size != iphone image size, you can add 6 files into 1 asset item.

    You can read more here http://krakendev.io/blog/4-xcode-asset-catalog-secrets-you-need-to-know

提交回复
热议问题