Default.png 中的动态版本编号

发布于 2024-12-20 14:04:16 字数 262 浏览 0 评论 0原文

我有一个 Default.png,其中包含版本号。每次更新我的应用程序时,我都必须在精简版和完整版的 default.png 和 [电子邮件受保护]。麻烦,不是吗?

我很确定我一直在以错误的方式处理这件事。我该怎么办? (我想在启动时显示版本号,而不是完全取消它。)

I have a Default.png which includes a version number on it. Every time I update my app, I have to change it both in the lite and full version's default.png and [email protected]. Hassle, no?

I'm pretty sure I've been going about this the wrong way. What should I do instead? (I would like to show a version number on launch, not just nix it altogether.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

童话 2024-12-27 14:04:16

编译时图像合成

如果您的徽标除了版本号之外不需要更改,那么您可以在编译时使用您选择的图形库来重构 png。伪代码如下:

伪代码:

UpdateLogo(String logoName, String version)
{
    WidgetImage MyLogo(logoName + ".png");
    MyLogo.DrawText(800, 650, version);
    MyLogo.Write(logoName + "Final.png");
}

UpdateLogo("Logo.png", "Version 1.0.0");

编译该程序并将其保留为自定义构建工具。然后,每当您需要构建应用程序时,您都可以将 Logo.png 编译为 LogoFinal.png。如果您需要使用 XCode 或其他工具生成图像文件的帮助,我建议您与“动态版本控制”分开搜索图像处理工具。

理想情况下,您的版本字符串将使用易于编辑的表中定义的常量或由构建系统控制的常量。至少,它可以让您免去每次需要构建应用程序时打开 Photoshop 的麻烦。

对于在正在运行的应用程序中显示,

您应该使用字体在徽标顶部绘制版本号。然后,您可以只包含一个基于文本的资源文件,并且可以通过每次构建的自动化工具轻松更新。

来源

Compile-Time Image Compositing

If your logo doesn't need to change other than the version number, then you can use your graphics library of choice at compile-time to refactor the png. Pseudo code below:

Pseudo-Code:

UpdateLogo(String logoName, String version)
{
    WidgetImage MyLogo(logoName + ".png");
    MyLogo.DrawText(800, 650, version);
    MyLogo.Write(logoName + "Final.png");
}

UpdateLogo("Logo.png", "Version 1.0.0");

Compile that program and keep it around as a custom build tool. Then whenever you need to build your application you can compile Logo.png into LogoFinal.png. If you need help using XCode or other tools to generate image files I suggest you search for image manipulation tools separately from "dynamic versioning".

Ideally your version string will use constants defined in an easily-editable table or controlled by your build system. At the very least it will save you from opening up Photoshop every time you need to build your app.

For Display in a Running Application

You should be using a font to draw the version number on top of the logo. Then you can just include a resource file that is text-based and can be easily updated by automated tools for each build.

Sources

英雄似剑 2024-12-27 14:04:16

Apple 的人机界面指南规定 Default.png 不应用作启动屏幕;它应该代表应用程序将显示的所有 UI 控件,但没有任何可本地化的文本或内容。 (想想 iPod 和通讯录等内置应用程序的行为方式。)

如果您是为客户做这件事并且他们有要求,您可以随时使用“但是应用程序商店可能会因为违反他们的条款而拒绝它!”争论。

当然,如果您不向商店提交或者您只是不在乎,则这不适用。 :)

为上面发帖的人提供的一个技术附加组件:确保您添加到构建过程中的任何 png 合成在 pngcrush 执行之前运行,这样您就不会用以下内容替换优化的图像脚本生成的(可能未优化的)。无论如何,如果您尝试在 pngcrush 运行后执行此操作(它不显示),您也可能会遇到奇怪的问题。

Apple's Human Interface Guidelines say that the Default.png shouldn't be used as a splash screen; it should represent all of the UI controls the application will show, but without any localizable text or content. (Think of how the the built-in apps like iPod and Contacts behave.)

If you're doing it for a client and they demand it, you can always use the "But the app store might reject it for violating their terms!" argument.

Of course, this doesn't apply if you're not submitting to the Store or if you just don't care. :)

A technical add-on for the people posting above: make sure that any png compositing you're adding to the build process runs before pngcrush executes, so that you're not replacing an optimized image with a script-generated (and likely unoptimized) one. You may also run into weird issues if you try doing it after pngcrush runs (it not displaying), anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文