在我的项目中,有一个框架项目,并且这个框架项目在资产目录中有图片..
In My Project, there is one framework project and this framework project has images in the assets catalog..
我想在我的主要项目的情节提要中使用这些图像.
I want to use theses images using the storyboard of my main project.
我可以通过像这样定义框架的捆绑包来使用类文件中的图像,
I can use the images in class files by defining the bundle of the framework like this,
myImageView.image = UIImage(named: "img1", in: Bundle.init(identifier: "com.abc"), compatibleWith: nil)
但不在情节提要中.所以我可以在情节提要中使用它还是只能使用代码?
but not in the storyboard. so Can I use it in storyboard or I have to go using code only ?
你不能直接使用其他框架的资产,但你可以将资产添加到你的主要目标作为参考:
You cannot use assets of other frameworks directly, but you can add the assets to your main target as reference:
将文件添加到 Project.xcodeproj..."
"Add Files to Project.xcodeproj..."
然后,您将能够在图像视图和按钮的属性检查器中选择资产容器的图像.
You will then be able to choose the images of the assets container in the attributes inspector of image views and buttons.
这篇关于如何从框架资产中设置故事板中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!