How to set image in storyboard from framework assests(如何从框架资产中设置故事板中的图像)
问题描述
在我的项目中,有一个框架项目,并且这个框架项目在资产目录中有图片..
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.
这篇关于如何从框架资产中设置故事板中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从框架资产中设置故事板中的图像


基础教程推荐
- Firebase 云消息传递令牌未生成 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01