xcode PDF 格式的新标签栏图标... 创建自定义的指南?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31979160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
New tab bar icons in PDF format... Guidelines to create custom?
提问by Nicolas Miari
I have noticed that in recent versions of Xcode, the project template for "Tabbed Application" creates a project where the tab bar icon images (dubbed "first" and "second", for the default two tabs/view controllers available) are actually stored in .pdf format, not .png, and displayed in the Assets.xcassets folder with a resolution of "All" for use as "Universal" (instead of -say- a resolution "@3x" for use as "iPhone app iOS 7-8", like the app icons).
我注意到在最新版本的 Xcode 中,“选项卡式应用程序”的项目模板创建了一个项目,其中实际存储了选项卡栏图标图像(称为“第一”和“第二”,对于默认的两个选项卡/视图控制器可用).pdf 格式,而不是 .png,并显示在 Assets.xcassets 文件夹中,分辨率为“All”以用作“Universal”(而不是分辨率“@3x”用作“iPhone app iOS 7” -8",如应用程序图标)。
I assume this is to provide a vector graphics-based resource that is truly resolution-independent and hence supports all sorts of devices.
我认为这是为了提供一种真正与分辨率无关的基于矢量图形的资源,因此支持各种设备。
My question is:What are the guidelines to create custom resources in this format? I guess it should start by creating a custom outline in Adobe Illustrator and exporting it in pdf format, but, What size and units should I use? Are there any other things to look out for? I haven't found anything in official Apple documentation and a web search for "ios tab bar icon pdf" only gives links to websites providing clip art etc.
我的问题是:以这种格式创建自定义资源的准则是什么?我想它应该首先在 Adobe Illustrator 中创建自定义轮廓并将其导出为 pdf 格式,但是,我应该使用什么尺寸和单位?还有什么需要注意的吗?我在 Apple 官方文档中没有找到任何内容,并且在网络上搜索“ios tab bar icon pdf”只提供指向提供剪贴画等的网站的链接。
Note:I have thought whether to post this question here or in Graphic DesignStack Exchange site, but it still has to do with the Xcode IDE and developing iOS apps, so I place my bet here. Feel free to vote for closing it if you think otherwise.
注意:我已经考虑过是在这里发布这个问题还是在Graphic DesignStack Exchange 站点上发布这个问题,但它仍然与 Xcode IDE 和开发 iOS 应用程序有关,所以我在这里打赌。如果您不这么认为,请随意投票关闭它。
采纳答案by MirekE
I assume this is to provide a vector graphics-based resource that is truly resolution-independent and hence supports all sorts of devices.
我认为这是为了提供一种真正与分辨率无关的基于矢量图形的资源,因此支持各种设备。
My understanding is that Xcode actually converts these vector images into bitmaps with appropriate resolution. So they are vectors only at design time and bitmaps at run time.
我的理解是 Xcode 实际上将这些矢量图像转换为具有适当分辨率的位图。所以它们仅在设计时是矢量,在运行时是位图。
What are the guidelines to create custom resources in this format? I guess it should start by creating a custom outline in Adobe Illustrator and exporting it in pdf format, but, What size and units should I use?
以这种格式创建自定义资源的准则是什么?我想它应该首先在 Adobe Illustrator 中创建自定义轮廓并将其导出为 pdf 格式,但是,我应该使用什么尺寸和单位?
Create the size in points, the same size as you want the icons. Then export as PDF. I noticed that some programs generate PDFs that look nice in Interface Builder, but are blank in the actual app. Perhaps Illustrator will work fine, but if not, try another program for the conversion to PDF.
创建以磅为单位的大小,与您想要的图标大小相同。然后导出为PDF。我注意到有些程序生成的 PDF 在 Interface Builder 中看起来不错,但在实际应用中却是空白的。也许 Illustrator 可以正常工作,但如果不行,请尝试另一个程序来转换为 PDF。
回答by deijmaster
I understand MirekE's answer as I lived the challenge and now have a solution. But for anyone else, here's a real world example.
我理解 MirekE 的答案,因为我经历了挑战,现在有了解决方案。但对其他人来说,这是一个真实世界的例子。
I create all my line icons (or anything of your choosing) using sketch (highly recommended) using a 30 X 30 Artboard then applying the drawings inside. I make the background transparent and then set my export to 1x size and apply the PDF format. Visible in this screenshot.
我使用 30 X 30 画板使用草图(强烈推荐)创建我所有的线条图标(或您选择的任何东西),然后在里面应用图纸。我使背景透明,然后将导出设置为 1x 大小并应用 PDF 格式。在此屏幕截图中可见。
Then it's a simple import into Xcode > create the object in Images.xcassets > select the image group > choose single vector from the pulldown scale factors (in the attributes inspector) > then just drag and drop the imported image in the single place holder.
然后它是一个简单的导入到 Xcode > 在 Images.xcassets 中创建对象 > 选择图像组 > 从下拉比例因子中选择单个向量(在属性检查器中)> 然后只需将导入的图像拖放到单个占位符中。
I've applied this approach to all my custom tabbar items and the result has been stellar.
我已经将这种方法应用于我所有的自定义标签栏项目,结果非常出色。