从iOS加载图像 [英] Load image from bundle with iOS

查看:79
本文介绍了从iOS加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中添加了一些 .bundle 文件夹,其中包含一些图片。
是否正确请参考此图片直接写出类似的内容?:

I added to my project a .bundle folder filled with some images. Is it correct refer to this image directly writing something like ?:

[UIImage imageNamed:@"imageInBundle.png"];

访问和使用这些图像的最佳方法是哪种?

Which is the best method to access and use these images ?

推荐答案

这是正确的, imageNamed:将搜索你的主包。项目中的图像,即使它们位于Project Navigator中的不同组中,也将位于主包中,可以直接通过名称访问。

That is correct, imageNamed: will search your main bundle. Images in your project, even if they are in different groups in your Project Navigator will be in your main bundle and can be accessed directly by name.

这篇关于从iOS加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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