【问题标题】:Access Images from Folder in Assets.xcassets in Xcode Swift从 Xcode Swift 中 Assets.xcassets 中的文件夹访问图像
【发布时间】:2016-09-28 04:41:57
【问题描述】:

如何从 Xcode 中 Assets.xcassets 中的文件夹访问图像? 我知道如何访问位于 Assets.xcassets 文件夹本身中的图像,但不确定如何访问位于 Assets.xcassets 中的特定文件夹中的内容。

我正在使用以下代码从 Assets.xcassets 访问图像:

// seperate file for image data containing a struct 
    struct Images {
    var images: [UIImage] = [UIImage(named: "image1.jpg")!]
}

// creating an instance of the image data swift file struct in view controller file  
    var myImages = Images() 

// setting the image property of UIImage in storyboard 
    UImageInstance.image = Images.images[1]

如果图像存储在 Assets.xcassets 内的文件夹中,我如何访问它们?而不仅仅是在 Assets.xcassets 中。

【问题讨论】:

  • 你在说右键点击 Assets.xcassets 并点击 Show in Finder
  • Never Mind :) 这与访问 Assets.xcassests 文件夹中的元素相同。

标签: ios swift xcode image


【解决方案1】:

相同 :) 与访问 Assets.xcassests 中的元素

【讨论】:

    猜你喜欢
    • 2017-01-12
    • 2019-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-28
    相关资源
    最近更新 更多