【问题标题】:Define Asset Catalog at runtime在运行时定义资产目录
【发布时间】:2017-02-28 14:03:36
【问题描述】:

我想知道是否可以在运行时定义哪个资产目录。

理想情况下,我希望拥有 assetsA.xcassets 和 assetsB.xcassets 并定义在运行时使用哪一个。

所有图像集都将具有相同的名称,例如 bgPattern,但看起来会略有不同。

【问题讨论】:

    标签: ios swift3 xcode8


    【解决方案1】:

    这应该/可以做你需要的......

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

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

    【讨论】:

      猜你喜欢
      • 2019-02-02
      • 1970-01-01
      • 2014-09-16
      • 2013-01-13
      • 1970-01-01
      • 1970-01-01
      • 2019-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多