如何在Xcode 5产品偏好编辑器中访问资产目录中的图像(用于文档图标) [英] How do I access images (for document icons) in an asset catalog in the Xcode 5 product preference editor

查看:70
本文介绍了如何在Xcode 5产品偏好编辑器中访问资产目录中的图像(用于文档图标)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在提交新的Mac应用程序之前,我想我实际上已经走到了最后一步,并且在过去的几个小时中,我一直在脑海中摸索着我认为应该非常,非常容易的事情.

I think I'm literally on the last step before submitting a new Mac app, and I've been banging my head against a wall for the past few hours on what I think should be really, really easy.

我已经为我的应用创建和使用的两种不同类型的图标设计了文档图标.我在Images.xcassets中创建了一个新的图标",并将相应的文件拖放到放置区域中.

I've designed document icons for the two different types of icons my app creates and works with. I created a new "Icon" in Images.xcassets, and dropped the appropriate files into the drop zones.

在产品编辑器->信息中,我转到文档类型信息所在的位置,但是当我尝试在文档类型"或已导出的UTI"部分的"icon"字段中输入图标名称时,该图标图像只是变成一个问号-图标的下拉菜单中没有选项.

In the product editor -> Info, I go to where the document type information is, but when I try to enter in the icon name in the "icon" field of either the Document Types or Exported UTI section, the icon image just turns into a question mark—no options show up in the drop down menus for icons.

如何使资产目录中的图像/图标显示在编辑器中?另外,如果我要手动将其输入到plist中,我将使用哪种格式来引用资产目录中的Icon文件?

How do I get the images/icons in the asset catalog to show up in the editor? Alternatively, if I was going to enter that manually into the plist, what sort of format would I use to reference an Icon file from the asset catalog?

我知道我可能在这里错过了一个简单的步骤,但是我看不到它!

I know I'm probably missing an easy step here, but I can't see it!

推荐答案

据我所知,Xcode当前不支持将.xcassets用于文档图标.有点奇怪-.xcassets编辑器显然允许您创建新图标,但它不会生成.icns文件,它只是将所有文件放在同一文件夹中,并使用plist对其进行管理.

To my knowledge, Xcode doesn't currently support using .xcassets for document icons. This is a little strange—the .xcassets editor clearly allows you to create new icons, but it doesn't generate .icns files, it just puts all the files in the same folder and uses a plist to manage them.

要为您的文档类型创建图标,请将图标的1024x1024版本上传到 http://iconverticons.com/online/将其转换为.icns文件.或者,您可以使用第三方工具来生成一个.icns文件,该文件具有不同分辨率的不同图像.开发人员工具中曾经包含一个很棒的工具来执行此操作,但是我似乎再也找不到它了.

To create an icon for your document types, upload the 1024x1024 version of the icon to http://iconverticons.com/online/ to convert it to a .icns file. Alternatively, you could use a third-party tool to generate an .icns file with different images for different resolutions. There used to be a great tool included in the Developer Tools for doing this, but I can't seem to find it anymore.

一旦有了icns文件,请将其添加到项目中,并且应该能够将其选择为文档类型"或外部/内部UTI"的图标".享受吧!

Once you've got an icns file, add it to your project and you should be able to select it as the "Icon" for your Document Type or External/Internal UTI. Enjoy!

说实话,可能值得为此提交一个错误.如今,Xcode的发展似乎受到iOS的强烈推动,他们可能还没有注意到这一点!

To be honest, it might be worth filing a bug about this. Xcode's development seems so strongly driven by iOS these days, they may not have noticed this yet!

这篇关于如何在Xcode 5产品偏好编辑器中访问资产目录中的图像(用于文档图标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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