Skip navigation.
 
mlConditionally modifying NIBs?
FROM : Mike Fischer
DATE : Wed May 14 19:37:31 2008

Hi!

Given the recent/ongoing discussion about bypassing Interface Builder 
I have one question/issue for which IB does not seem to provide any 
solution. Interface Builder and NIBs are nice and have many 
advantages but I am missing a way to build different versions of nib 
files depending on Project targets/settings. I'm wondering how others 
handle this?

Details:
Let's say I have a project which includes a nib N1 which builds a 
target T1.
Now I want to add a new target T2 which builds a variant of of T1 
that adds some elements to nib N1 and removes some others (N2).

I could create a copy of nib N1 and modify it of course. But that has 
two major drawbacks:
1) Whenever any of the parts of nib N1 and N2 change that are 
identical in both nibs I have to remember to make the changes in both.
2) This solution does not scale very well when dealing with more than 
one variant.

I remember in the very dim past (when MacApp was still a modern 
framework ;-) that I had text based resource files (.r) to build the 
'View' resources (rough analog to nibs) which included preprocessor 
macros to control which parts/features where active. These would be 
compiled into .rsrc files using the current build settings. This 
mechanism was very flexible when it came to building different 
variants of an application. (I admit though that the source was hard 
to read and edit due to all of the conditional stuff.)

Is there any way to achieve someting similar in our modern Cocoa/
Xcode/IB world? How do others handle this problem?


Thanks!
Mike
--
Mike Fischer        Softwareentwicklung, EDV-Beratung
                                    Schulung, Vertrieb
Web: <http://homepage.mac.com/mike_fischer/index.html>
Note:                I read this list in digest mode!
          Send me a private copy for faster responses.

Related mailsAuthorDate
mlConditionally modifying NIBs? Mike Fischer May 14, 19:37
mlRe: Conditionally modifying NIBs? David Wilson May 14, 20:11
mlRe: Conditionally modifying NIBs? Mike Fischer May 14, 20:32
mlRe: Conditionally modifying NIBs? Hamish Allan May 15, 00:07
mlRe: Conditionally modifying NIBs? Mike Fischer May 15, 00:25
mlRe: Conditionally modifying NIBs? Hamish Allan May 15, 01:10
mlRe: Conditionally modifying NIBs? Jonathan Hess May 15, 02:20
mlRe: Conditionally modifying NIBs? Mike Fischer May 15, 13:25
mlRe: Conditionally modifying NIBs? Mike Fischer May 15, 13:26
mlRe: Conditionally modifying NIBs? Jonathan Hess May 15, 22:36
mlRe: Conditionally modifying NIBs? Uli Kusterer May 18, 11:14
mlRe: Conditionally modifying NIBs? Mike Fischer May 18, 15:48