【发布时间】: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 文件夹中的元素相同。