简体   繁体   English

在运行时定义资产目录

[英]Define Asset Catalog at runtime

I want to know if its possible to define which asset catalog at run time. 我想知道是否可以在运行时定义哪个资产目录。

Ideally I'd like to have assetsA.xcassets and assetsB.xcassets and define which one to use at runtime. 理想情况下,我想拥有assetsA.xcassets和assetsB.xcassets,并定义在运行时使用哪一个。

All the image sets will have the same names, eg bgPattern but would look slightly different. 所有图像集都具有相同的名称,例如bgPattern,但看起来会略有不同。

This should / may do what you need... 这应该/可能做你需要的......

init?(named name: String, in bundle: Bundle?, 
        compatibleWith traitCollection: UITraitCollection?)

https://developer.apple.com/reference/uikit/uiimage/1624154-init https://developer.apple.com/reference/uikit/uiimage/1624154-init

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM