当有数千张图像时,是否有一个技巧可以节省在 Xcode 中构建的时间? [英] Is there a trick to save time building in Xcode when there are thousands of images?

查看:32
本文介绍了当有数千张图像时,是否有一个技巧可以节省在 Xcode 中构建的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了测试动画类的功能,我创建了 5000 个全屏图像,每个图像大小为 100kb.我只在我的项目中添加了 1000 个,现在 Xcode 已经构建了 30 分钟.下次如果 Xcode 只使用来自先前构建的已经 alpha 预乘的图像而不是愚蠢地重建所有内容,那就太好了.我有机会让它发挥作用吗?

For testing the capabilities of an animation class I have created 5000 fullscreen images with 100kb size each. I added just 1000 of them to my project and Xcode is already building for 30 minutes now. The next time it would be nice if Xcode just uses the already alpha-premultiplied images from a previous build instead of stupidedly rebuilding everything. Any chance I can get that to work?

推荐答案

将构建设置 IPHONE_OPTIMIZE_OPTIONS=-skip-PNGs 添加到任何不希望修改 PNG 的目标.方法如下:

Add the build setting IPHONE_OPTIMIZE_OPTIONS=-skip-PNGs to any target that doesn't want the PNGs modified. Here's how:

转到您的项目构建设置.

Go to your projects build settings.

左下角是一个看起来像齿轮的菜单图标

In the lower left hand corner is a menu you icon that looks like a GEAR

选择添加用户定义的设置

Choose Add User-Defined Setting

为设置命名:IPHONE_OPTIMIZE_OPTIONS

Name the setting: IPHONE_OPTIMIZE_OPTIONS

将值设置为:-skip-PNGs

Set the Value to: -skip-PNGs

做一个干净的构建和你的好去

Do a clean build and your good to go

我们的想法是在您编译一次代码后执行此操作.这样,图像被正确处理一次,然后您不再需要 XCode 来执行此操作.积分转到这个网站.

The idea is to do this only after you've compiled your code once. This way, the images are correctly processed once, and then you don't need XCode to do it any longer. Credits go to this site.

这篇关于当有数千张图像时,是否有一个技巧可以节省在 Xcode 中构建的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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