Dynamic Version Numbering in a 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 default@2x.png. 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.)


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:


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.


Answered By – Will Bickford

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published