views:

312

answers:

1

Hi all,

I have following issue: I have an iPhone application which can be compiled using various color styles. So the goal is to have several build configurations with defined style, for instance COLOR_STYLE_BLACK. Style definition files should be placed under some subfolder in source tree, like, for example Classes/styles/black. Then, in App_Prefix.pch I'd like to #import files from respective subfolder, like following:

#ifdef `COLOR_STYLE_BLACK`
    #import "styles/black/DefaultStyle.h"
#endif

But the issue is that I cannot make XCode to import files from subfolders. It seems XCode does not allows folder structures in project, or at least I cannot figure out how to do it.

When I add folders as folder references to the project, XCode copies them to the Rersources folder, but does not add them to Compile sources build phase and reports errors on missing files.

Thanks for any tip or advice on this. Matthes

A: 

The bigger issue here is that you're hardcoding your theme in sourcecode.

Its only ever the most extreme customisation that should be done this way. Its sound advice that your theme should be in artwork and you should select it at runtime by varying the path you load the artwork from and such.

Will
This is not the way I can go. First, only a few screens are build using Iterface builder and most of them are created programmaticaly, second, I need to build possibly 10+ app variations and manage such a number of xib files (including localizations!) is silly idea.So the question remains. Any idea?
Matthes