On Sun, Jul 13, 2008 at 5:01 PM, Jim Crafton <[EMAIL PROTECTED]> wrote: > I'd like to be able to create an application's menu from scratch, > without a nib file.
Can you elaborate on why? Most of the time from what I've seen, when people think they need to do this, they really don't. For example: - People making games want to control everything. It works just as well if you make a little NSApp delegate object in the MainMenu.nib and take control from there. - People implementing a framework that needs to create everything programmatically. Instead of going without a nib, create a stub MainMenu.nib which contains as little as possible but still gets your program up and running. At that point you can then customize the menu and everything else in code. - If you're making a naked binary, there's might be no good place to put the nib. This case is a little trickier, but you can work around it. You can do this by taking advantage of the fact that the NSNib class supports NSCoding. Make a little helper tool that loads the nib using NSNib, serializes it with NSKeyedArchiver, and then writes the data into something readable. (If you're embedding into your source, you can have it output C char array syntax.) Then your main binary can load that data into an NSData, reconstitute the NSNib object from it, and load it. - Learning. Occasionally somebody decides that building a nibless application is the best way to learn about Cocoa. From what I've seen it's really just a very complicated way to learn about a bunch of painful, otherwise-useless aspects of Cocoa. I'm sure we can help you out if you want more information about any of the above propositions. Mike _______________________________________________ Cocoa-dev mailing list ([email protected]) 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
