如何从特定组加载图像? [英] How to load images from a specific group?

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

问题描述

在Xcode4中,我使用组来对我的东西进行分组,例如,对于各种图像,我有一个像树的树状层次结构.有趣的是,我可以直接访问图像而无需指定组.

In Xcode4, I use groups for grouping my stuff, for example I have a tree like group hierarchy for my various images. The interesting part is that I can access an image directly without specifying a group.

UIImage *img = [UIImage imageWithName:@"image1.png"];

我有两个问题.首先,如何定义所有需要的图像所在的组的具体路径(例如,对于"Img/Enemy/"组树)?第二,如何遍历该组路径以加载该组中的所有图像?恕我直言,组与捆绑包有关,但我发现它们非常令人困惑:(

I have two questions. First, how to define concrete path of groups where resides all needed images (for example for the group tree "Img/Enemy/")? And a second, how to iterate through that group path to load all the images from that group? IMHO groups are related to bundles but I found them very confusing :(

推荐答案

使用组时,实际上并没有创建文件夹,因此在构建应用程序时,所有内容都放在捆绑包的根目录中.这就是为什么您无需指定组名即可访问它们的原因.如果要使用文件夹,则可以在Finder中创建文件夹并将其添加到项目中(请确保选中为任何添加的文件夹创建文件夹引用"!).

When you use groups, you are not actually creating folders, so when you build your app everything is put at the root of the bundle. This is why you can access them without specifying the group name. If you want to use folders, you can create folders in Finder and add them to the project (make sure to check "create folder references for any added folders"!).

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

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