如何在 Xcode 的 Resources 文件夹中捆绑非版本控制的图像? [英] How to bundle non-version controlled images in Xcode's Resources folder?

查看:22
本文介绍了如何在 Xcode 的 Resources 文件夹中捆绑非版本控制的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我们尝试过但没有奏效的方法

Here are the approaches we tried but did not work

  • 版本控制图像 - 使我们的 git 存储库膨胀,这不是一个好主意
  • DropBox 上的图片 - 每当我们的设计师在 Dropbox 上添加图片时,工程师都可以使用它,但工程师随后必须手动将新图片添加到他们的资源中.
  • DB 上的图片文件夹,资源下的链接文件夹 - 同上,但我们添加的是资源下的文件夹,而不是图片文件.但是,添加新添加的图像的手动过程仍然存在.
  • Version control the images - bloats up our git repo, not a good idea
  • Images on DropBox - Whenever our designer adds an image on Dropbox it gets available to engineers, but the engineers then have to add the new image to their Resources manually.
  • Image folder on DB, link folder under Resources - Same as above, but we add the folder under Resources, not the image files. However, the manual process of adding newly added images still remain.

您遵循的最佳做法是什么?

What are the best practices you have followed?

推荐答案

在将文件夹引用添加到您的项目并使用 DropBox 使该文件夹与您的图像保持同步时,您是否尝试过添加文件夹引用而不是组?

Have you tried adding a Folder Reference instead of a group when adding it to your project and using DropBox to keep that folder up to date with your images ?

>

作为文件夹引用,它应该始终反映链接文件夹的当前状态,而无需在从数据库下载每个文件时手动添加.

As a Folder Reference, it should always reflect the current state of the linked folder without the need to manually add each file as it is downloaded from DB.

运行快速测试后,我发现添加文件夹引用并尝试使用 [UIImage imageNamed:@"fileName.png"] 中的图像找不到实际图像.
您必须实际包含文件夹引用的相对路径,如下所示:

After running a quick test, I found that adding Folder References and trying to use the images from there with [UIImage imageNamed:@"fileName.png"] doesn't find the actual image.
You have to actually include the relative path to your Folder Reference, like this:

UIImage * imageFromFolderReference = [UIImage imageNamed:@"FolderReferenceName/fileName.png"];

这似乎奏效了.

这篇关于如何在 Xcode 的 Resources 文件夹中捆绑非版本控制的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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