Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditionally modifying NIBs?



Am 15.05.2008 um 00:07 schrieb Hamish Allan:

On Wed, May 14, 2008 at 6:37 PM, Mike Fischer <email@hidden> wrote:

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?

You could use XIB files instead of NIB files, and write a script to process them as a build step before they are compiled...

Sure, that would be fine.

Do you happen to have the official format description handy?

The only thing I found was this:
XIB files are not human editable
XIB files are the result of writing an in-memory object graph to disk, by using a custom serialization protocol. Editing XIB files by hand is not suggested, extremely dangerous, and can lead to corrupted interfaces
XIB 3.x and NIB 3.x files are not backward compatible for development
There are some features that can only be developed using the XIB 3.x or NIB 3.x formats. Support for these features—such as support for toolbars, and the promotion of cells to first-class citizens— either required underlying changes in AppKit to support, or introduced new content into the document hierarchy that previous versions of Interface Builder can not handle. Interface Builder 3.0 includes an automatic compatibility check, performed before saving, which will inform you of items which affect the file format compatibility.

From <http://developer.apple.com/releasenotes/DeveloperTools/RN- InterfaceBuilder/index.html>


(I know this can be hacked, and that while verbose it's only xml. But I'd want my apps building in the next Xcode (sub-)release as well.)


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.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Conditionally modifying NIBs? (From: Mike Fischer <email@hidden>)
 >Re: Conditionally modifying NIBs? (From: "Hamish Allan" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.