在Interface Builder中使用Asset Catalog上的图像 [英] Use images on Asset Catalog in Interface Builder

查看:84
本文介绍了在Interface Builder中使用Asset Catalog上的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以直接在界面构建器上使用添加到Assets Catalog的图像?
如何完成?

Is it possible to use the images added to Assets Catalog directly on interface builder? How is that done?

在UIImageView属性上,我看不到任何引用资产目录上任何图像的选项。

On UIImageView properties I can't see any option to reference any image on assets catalog.

推荐答案


  1. 将图像导入 .xcassets 文件夹


    • 点击右下角的'+','导入文件夹'

  1. Import the images into the .xcassets folder
    • click the '+' in the bottom right, 'Import folder'

然后可以使用图像以编程方式引用 UIImage * image = [UIImage imageNamed:@some-image] ,或通过IB / Storyboards中的图像下拉列表。

Images can then be referenced programmatically with UIImage *image = [UIImage imageNamed:@"some-image"], or via the image dropdown in IB/Storyboards.

这篇关于在Interface Builder中使用Asset Catalog上的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆